Skip to content

Commit 2bf25c8

Browse files
author
jessiLeandro
committed
add dark theme and ligth theme
1 parent 7105c29 commit 2bf25c8

File tree

14 files changed

+269
-179
lines changed

14 files changed

+269
-179
lines changed

src/app/core/interceptors/header.interceptor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class HeaderInterceptor implements HttpInterceptor {
1717

1818
intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
1919

20-
const token = this.storage.getItem('planning-poker-token');
20+
const token = this.storage.getItem('@planningPoker:token');
2121
const Authorization = `Bearer ${token}`
2222

2323
return next.handle(request.clone({ setHeaders: { Authorization } }));

src/app/core/services/auth/auth.service.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Injectable } from '@angular/core';
2-
import { JwtHelperService } from "@auth0/angular-jwt";
2+
import { JwtHelperService } from '@auth0/angular-jwt';
33

44
@Injectable({
55
providedIn: 'root',
@@ -14,16 +14,16 @@ export class AuthService {
1414
}
1515

1616
auth() {
17-
const token = this.storage.getItem('planning-poker-token');
18-
const isExpired = this.jwtHelper.isTokenExpired(token || "");
17+
const token = this.storage.getItem('@planningPoker:token');
18+
const isExpired = this.jwtHelper.isTokenExpired(token || '');
1919

20-
if(isExpired) return false;
20+
if (isExpired) return false;
2121

2222
return true;
2323
}
2424

2525
decode(){
26-
const token = this.storage.getItem('planning-poker-token');
26+
const token = this.storage.getItem('@planningPoker:token');
2727
const decodeToken = this.jwtHelper.decodeToken(token || "")
2828
return decodeToken ? decodeToken : "";
2929
}
Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
1-
header{
2-
display: flex;
3-
align-items: center;
4-
flex-direction: row;
5-
justify-content: space-between;
1+
header {
2+
display: flex;
3+
align-items: center;
4+
flex-direction: row;
5+
justify-content: space-between;
66
}
77

8-
h1{
9-
color: #1A237E; /*$indigo-palette 900*/
10-
margin: 0;
8+
h1 {
9+
margin: 0;
1110
}
1211

13-
form{
14-
display: flex;
15-
align-items: center;
16-
flex-direction: column;
17-
justify-content: center;
18-
margin: 50px;
12+
form {
13+
display: flex;
14+
align-items: center;
15+
flex-direction: column;
16+
justify-content: center;
17+
margin: 50px;
1918
}
2019

21-
.input-field{
22-
width: 400px;
23-
margin-bottom: 30px;
20+
.input-field {
21+
width: 400px;
22+
margin-bottom: 30px;
2423
}
2524

26-
.button-submit{
27-
width: 50%;
28-
}
25+
.button-submit {
26+
width: 50%;
27+
}
Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
1-
21
<header>
3-
<h1 mat-dialog-title>New Poker</h1>
4-
<button mat-icon-button mat-dialog-close cdkFocusInitial>
5-
<mat-icon>close</mat-icon>
6-
</button>
2+
<h1 class="ppa-title" mat-dialog-title>New Poker</h1>
3+
<button mat-icon-button mat-dialog-close cdkFocusInitial>
4+
<mat-icon>close</mat-icon>
5+
</button>
76
</header>
87

98
<mat-dialog-content class="mat-typography">
109
<div class="wrapper-form">
1110
<form [formGroup]="formCreatePoker">
12-
<mat-form-field class="input-field" appearance="fill">
13-
<mat-label>Nome</mat-label>
14-
<input matInput placeholder="Nome" formControlName="pokerName"/>
15-
<mat-error>
16-
{{getErrorMessage("pokerName")}}
17-
</mat-error>
18-
</mat-form-field>
19-
<button
20-
class="button-submit"
21-
mat-raised-button
22-
color="primary"
23-
(click)="createPoker()"
24-
>
25-
Criar
26-
</button>
11+
<mat-form-field class="input-field" appearance="fill">
12+
<mat-label>Nome</mat-label>
13+
<input matInput placeholder="Nome" formControlName="pokerName" />
14+
<mat-error>
15+
{{ getErrorMessage("pokerName") }}
16+
</mat-error>
17+
</mat-form-field>
18+
<button
19+
class="button-submit"
20+
mat-raised-button
21+
color="primary"
22+
(click)="createPoker()"
23+
>
24+
Criar
25+
</button>
2726
</form>
28-
</div>
29-
</mat-dialog-content>
27+
</div>
28+
</mat-dialog-content>

src/app/modules/home/components/home.component.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,28 @@ import { CreatePokerComponent } from './create-poker/create-poker.component';
66
@Component({
77
selector: 'app-home',
88
templateUrl: './home.component.html',
9-
styleUrls: ['./home.component.css']
9+
styleUrls: ['./home.component.css'],
1010
})
1111
export class HomeComponent implements OnInit {
12+
private storage: Storage;
1213

14+
isDarkTheme: boolean = false;
1315

14-
15-
constructor(
16-
private pokerService: PokerService,
17-
public dialog: MatDialog,
18-
) { }
16+
constructor(private pokerService: PokerService, public dialog: MatDialog) {
17+
this.storage = window.localStorage;
18+
}
1919

2020
ngOnInit(): void {
2121
this.pokerService.post({}).subscribe((res) => {
2222
console.log(res);
23-
2423
});
25-
}
2624

27-
createPoker(){
28-
const dialogRef = this.dialog.open(CreatePokerComponent);
25+
const theme = this.storage.getItem('@planningPoker:theme');
2926

27+
if (theme === 'dark') this.isDarkTheme = true;
3028
}
3129

30+
createPoker() {
31+
const dialogRef = this.dialog.open(CreatePokerComponent);
32+
}
3233
}

src/app/modules/home/home/home.component.html

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
<app-navbar></app-navbar>
2-
<div id="container">
1+
<div
2+
id="wrapper-container"
3+
[ngClass]="{'dark-theme': isDarkTheme}"
4+
class="mat-app-background">
5+
<app-navbar [(isDarkTheme)]="isDarkTheme"></app-navbar>
6+
<div id="container">
7+
38
<header>
4-
<h4>Meus Pokers</h4>
9+
<h4 class="ppa-title" >Meus Pokers</h4>
510
<button
611
id="button-create-poker"
712
mat-raised-button
@@ -11,7 +16,7 @@ <h4>Meus Pokers</h4>
1116
Criar Pokers
1217
</button>
1318
</header>
14-
19+
1520
<div id="content">
1621
<mat-accordion class="example-headers-align" multi>
1722
<mat-expansion-panel>
@@ -31,12 +36,12 @@ <h4>Meus Pokers</h4>
3136
</div>
3237
</mat-panel-description>
3338
</mat-expansion-panel-header>
34-
39+
3540
<mat-form-field appearance="fill">
3641
<mat-label>First name</mat-label>
3742
<input matInput>
3843
</mat-form-field>
39-
44+
4045
<mat-form-field appearance="fill">
4146
<mat-label>Age</mat-label>
4247
<input matInput type="number" min="1">

src/app/modules/login/components/login-form/login-form.component.html

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ <h1 class="mat-headline" color="primary">Log in</h1>
88
<mat-grid-tile>
99
<mat-form-field class="width-form-field" appearance="outline">
1010
<mat-label>Email</mat-label>
11-
<input matInput placeholder="[email protected]" formControlName="email" />
11+
<input
12+
matInput
13+
placeholder="[email protected]"
14+
formControlName="email"
15+
/>
1216
<mat-error>
13-
{{getErrorMessage("email")}}
17+
{{ getErrorMessage("email") }}
1418
</mat-error>
1519
</mat-form-field>
1620
</mat-grid-tile>
@@ -24,17 +28,11 @@ <h1 class="mat-headline" color="primary">Log in</h1>
2428
formControlName="password"
2529
[type]="hide ? 'password' : 'text'"
2630
/>
27-
<button
28-
mat-icon-button
29-
matSuffix
30-
(click)="hide = !hide"
31-
[attr.aria-label]="'Hide password'"
32-
[attr.aria-pressed]="hide"
33-
>
34-
<mat-icon>{{ hide ? "visibility_off" : "visibility" }}</mat-icon>
35-
</button>
31+
<mat-icon style="cursor: pointer" matSuffix (click)="hide = !hide">{{
32+
hide ? "visibility_off" : "visibility"
33+
}}</mat-icon>
3634
<mat-error>
37-
{{getErrorMessage("password")}}
35+
{{ getErrorMessage("password") }}
3836
</mat-error>
3937
</mat-form-field>
4038
</mat-grid-tile>
@@ -48,25 +46,18 @@ <h1 class="mat-headline" color="primary">Log in</h1>
4846
>
4947
Entrar
5048
</button>
51-
5249
</mat-grid-tile>
53-
5450
</mat-grid-list>
55-
5651
</form>
5752

5853
<mat-grid-list cols="1" rowHeight="100px">
5954
<mat-grid-tile>
6055
<p>
6156
Não possui conta?
62-
<button
63-
mat-button
64-
color="primary"
65-
routerLink="/poker/signUp">
66-
Cadastre-se
57+
<button mat-button color="primary" routerLink="/poker/signUp">
58+
Cadastre-se
6759
</button>
6860
</p>
6961
</mat-grid-tile>
7062
</mat-grid-list>
71-
7263
</div>

src/app/modules/login/components/login-form/login-form.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class LoginFormComponent implements OnInit {
3636
this.userService.login(this.form.value).subscribe((res) => {
3737
const { token } = res;
3838

39-
this.storage.setItem('planning-poker-token', token);
39+
this.storage.setItem('@planningPoker:token', token);
4040
this.router.navigate(['home']);
4141
});
4242
}
Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,48 @@
1-
.content{
1+
.content {
22
width: 100%;
33
height: 100vh;
4-
background-color: #1A237E; /*$indigo-palette 900*/
4+
background-color: #1a237e; /*$indigo-palette 900*/
55
}
66

7-
#logo{
7+
#logo {
88
width: 100%;
99
height: 100%;
1010
background-size: 120px 120px;
11-
background-image:
12-
linear-gradient(to right, #1A237E, transparent),
13-
/*$indigo-palette 900*/
14-
repeating-conic-gradient(from 0deg, #1A237E 0deg 90deg, #3F51B5 90deg 180deg)
15-
/*$indigo-palette 900*/ /*$indigo-palette 500*/
16-
;
17-
box-shadow: inset 0px 0px 10em 14em #1A237E; /*$indigo-palette 900*/
11+
background-image: linear-gradient(to right, #1a237e, transparent),
12+
/*$indigo-palette 900*/
13+
repeating-conic-gradient(
14+
from 0deg,
15+
#1a237e 0deg 90deg,
16+
#3f51b5 90deg 180deg
17+
)
18+
/*$indigo-palette 900*/ /*$indigo-palette 500*/;
19+
box-shadow: inset 0px 0px 10em 14em #1a237e; /*$indigo-palette 900*/
1820
color: #fafafa;
1921
display: flex;
2022
flex-direction: column;
2123
align-items: center;
2224
justify-content: center;
2325
}
2426

25-
#img-hello{
27+
#logo span p {
28+
font-family: "Poker In October", Roboto, sans-serif;
29+
}
30+
31+
#img-hello {
2632
width: 40%;
2733
}
2834

29-
span{
35+
span {
3036
font-size: 4em;
3137
font-weight: bolder;
3238
}
3339

34-
p{
40+
p {
3541
display: inline;
3642
font-size: 0.5em;
3743
}
3844

39-
.container{
45+
.container {
4046
min-width: 450px;
4147
max-width: 450px;
4248
}

src/app/modules/login/login.module.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,15 @@ import { LoginComponent } from './login.component';
88
import { LoginFormComponent } from './components/login-form/login-form.component';
99
import { RouterModule } from '@angular/router';
1010

11-
12-
1311
@NgModule({
14-
declarations: [
15-
LoginFormComponent,
16-
LoginComponent,
17-
SignUpComponent,
18-
],
12+
declarations: [LoginFormComponent, LoginComponent, SignUpComponent],
1913
imports: [
2014
CoreModule,
2115
SharedModule,
2216
CommonModule,
2317
LoginRoutingModule,
2418
RouterModule,
2519
],
26-
exports: []
20+
exports: [],
2721
})
28-
export class LoginModule { }
22+
export class LoginModule {}

0 commit comments

Comments
 (0)