-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add cookie disclaimer banner (#68)
* feat: add cookie disclaimer * fix: fix mistakes in cookie disclaimer. * fix: improve cookie banner grammar --------- Co-authored-by: Daniel Jancar <[email protected]>
- Loading branch information
1 parent
171a986
commit d2138b0
Showing
8 changed files
with
83 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<app-navbar /> | ||
<router-outlet /> | ||
<div class="mb-20"></div> | ||
<app-disclaimer /> |
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
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
Empty file.
22 changes: 22 additions & 0 deletions
22
apps/frontend/src/app/shared/navigation/disclaimer/disclaimer.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,22 @@ | ||
@if (!hasAcceptedCookies()) { | ||
<div class="pointer-events-none fixed inset-x-0 bottom-0 px-6 pb-6"> | ||
<div | ||
class="pointer-events-auto ml-auto max-w-xl rounded-xl bg-white p-6 shadow-lg ring-1 ring-gray-900/10" | ||
> | ||
<p class="text-sm leading-6 text-gray-900"> | ||
We use cookies to enhance your experience. Any data, such as your wallet | ||
address, is only shared between you and the Stellar Network. By using our | ||
site, you consent to this. | ||
</p> | ||
<div class="mt-4 flex items-center gap-x-5"> | ||
<button | ||
(click)="acceptCookies()" | ||
type="button" | ||
class="rounded-md bg-gray-900 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-gray-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-900" | ||
> | ||
Accept | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
} |
22 changes: 22 additions & 0 deletions
22
apps/frontend/src/app/shared/navigation/disclaimer/disclaimer.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,22 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing' | ||
|
||
import { DisclaimerComponent } from './disclaimer.component' | ||
|
||
describe('DisclaimerComponent', () => { | ||
let component: DisclaimerComponent | ||
let fixture: ComponentFixture<DisclaimerComponent> | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [DisclaimerComponent], | ||
}).compileComponents() | ||
|
||
fixture = TestBed.createComponent(DisclaimerComponent) | ||
component = fixture.componentInstance | ||
fixture.detectChanges() | ||
}) | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy() | ||
}) | ||
}) |
21 changes: 21 additions & 0 deletions
21
apps/frontend/src/app/shared/navigation/disclaimer/disclaimer.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,21 @@ | ||
import { Component } from '@angular/core' | ||
import { CookieService } from 'ngx-cookie-service' | ||
import { RouterLink } from '@angular/router' | ||
|
||
@Component({ | ||
selector: 'app-disclaimer', | ||
standalone: true, | ||
imports: [RouterLink], | ||
templateUrl: './disclaimer.component.html', | ||
styleUrl: './disclaimer.component.css', | ||
}) | ||
export class DisclaimerComponent { | ||
constructor(private cookieService: CookieService) {} | ||
acceptCookies() { | ||
this.cookieService.set('disclaimer', 'accepted', 365) | ||
} | ||
|
||
hasAcceptedCookies() { | ||
return this.cookieService.check('disclaimer') | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.