-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #286 from SharebookBR/release
Cookie Consent
- Loading branch information
Showing
6 changed files
with
134 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,6 @@ | |
|
||
<router-outlet></router-outlet> | ||
|
||
<app-cookie-consent></app-cookie-consent> | ||
|
||
<app-footer></app-footer> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/app/components/cookieconsent/cookieconsent.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div class="cookieconsent" *ngIf="!consentHide"> | ||
<span>{{consent.text}}<a routerLink="/politica-privacidade">{{consent.link}}</a></span> | ||
<div> | ||
<button class="btnaccept" (click)="consentUser(true)">{{consent.accept}}</button> | ||
<button class="btnclose" (click)="consentUser(false)">{{consent.close}}</button> | ||
</div> | ||
</div> |
50 changes: 50 additions & 0 deletions
50
src/app/components/cookieconsent/cookieconsent.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
.cookieconsent { | ||
position: fixed; | ||
z-index: 9999; | ||
background: #f0f0f0; | ||
width: 100%; | ||
bottom: 0; | ||
height: 160px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-evenly; | ||
-webkit-touch-callout: none; | ||
-webkit-user-select: none; | ||
-khtml-user-select: none; | ||
-moz-user-select: none; | ||
-ms-user-select: none; | ||
user-select: none; | ||
flex-direction: column; | ||
span { | ||
font-size: 1.1rem; | ||
padding: 0 10px; | ||
} | ||
a { | ||
color: #676767; | ||
margin-left: 5px; | ||
font-weight: bold; | ||
cursor: pointer; | ||
text-decoration: underline; | ||
font-size: 1.1rem; | ||
} | ||
div { | ||
width: 100%; | ||
display: flex; | ||
justify-content: space-evenly; | ||
.btnaccept { | ||
border: none; | ||
padding: 10px 15px; | ||
background: #444; | ||
color: #fff; | ||
margin-right: 25px; | ||
outline: none; | ||
border-radius: 0.25rem; | ||
} | ||
.btnclose { | ||
background: none; | ||
color: #444; | ||
border: none; | ||
outline: none; | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/app/components/cookieconsent/cookieconsent.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { CookieconsentComponent } from './cookieconsent.component'; | ||
|
||
describe('CookieconsentComponent', () => { | ||
let component: CookieconsentComponent; | ||
let fixture: ComponentFixture<CookieconsentComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ CookieconsentComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(CookieconsentComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
35 changes: 35 additions & 0 deletions
35
src/app/components/cookieconsent/cookieconsent.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-cookie-consent', | ||
templateUrl: './cookieconsent.component.html', | ||
styleUrls: ['./cookieconsent.component.scss'], | ||
}) | ||
export class CookieConsentComponent implements OnInit { | ||
public consent: any = { | ||
text: | ||
'Esse site salva cookies para uma melhor experiência de usuário. Saiba mais lendo nossa', | ||
link: 'Política de Privacidade.', | ||
accept: 'Quero continuar', | ||
close: 'Fechar', | ||
}; | ||
public consentHide: any = | ||
localStorage.getItem('cookieconsent_status') == null | ||
? false | ||
: localStorage.getItem('cookieconsent_status'); | ||
constructor() {} | ||
|
||
ngOnInit() {} | ||
|
||
public consentUser(decision) { | ||
switch (decision) { | ||
case true: | ||
localStorage.setItem('cookieconsent_status', 'true'); | ||
this.consentHide = true; | ||
break; | ||
default: | ||
this.consentHide = true; | ||
break; | ||
} | ||
} | ||
} |