Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add login page #136

Merged
merged 18 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions apps/taiga-lumbermill/public/apple.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions apps/taiga-lumbermill/public/github-mark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions apps/taiga-lumbermill/public/google.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions apps/taiga-lumbermill/src/components/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,12 @@ export const appRoutes: Route[] = [
(mod) => mod.CommonPageComponent,
),
},
{
path: 'login',
loadComponent: async () =>
import('../../dashboards/login/login.component').then(
(mod) => mod.LoginComponent,
),
},
{path: '**', redirectTo: 'dashboards'},
];
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,21 @@
</header>
</div>
</div>
<div
routerLink="/login"
tuiAppearance="whiteblock"
tuiCardLarge="normal"
class="card"
>
<div>
<header tuiHeader>
<h2
tuiTitle
[style.text-align]="'center'"
>
Login
MishaZhem marked this conversation as resolved.
Show resolved Hide resolved
</h2>
</header>
</div>
</div>
</div>
130 changes: 130 additions & 0 deletions apps/taiga-lumbermill/src/dashboards/login/login.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<div
tuiAppearance="whiteblock"
tuiCardLarge="normal"
class="card"
>
<header tuiHeader>
<h2
tuiTitle
[style.text-align]="'center'"
>
Login
MishaZhem marked this conversation as resolved.
Show resolved Hide resolved
</h2>
</header>
<form
[formGroup]="form"
(submit)="onSubmit()"
>
<tui-input
formControlName="email"
tuiHintContent="Email"
type="email"
class="block-input"
>
email
<input tuiTextfieldLegacy />
</tui-input>

<tui-error
formControlName="email"
[error]="[] | tuiFieldError | async"
[style.margin-bottom]="'0.8rem'"
[style.margin-right]="'auto'"
/>

<tui-input-password
formControlName="password"
tuiHintContent="Password"
type="password"
class="block-input"
>
password
<input tuiTextfieldLegacy />
</tui-input-password>
<tui-error
formControlName="password"
[error]="[] | tuiFieldError | async"
[style.margin-bottom]="'0.8rem'"
[style.margin-right]="'auto'"
MishaZhem marked this conversation as resolved.
Show resolved Hide resolved
/>
<div class="under-password">
<label tuiLabel>
<input
checked
formControlName="rememberMe"
tuiCheckbox
type="checkbox"
/>
<span
tuiTitle
MishaZhem marked this conversation as resolved.
Show resolved Hide resolved
[style.color]="'var(--tui-text-secondary)'"
>
Remember me
</span>
</label>
<a tuiLink>Forgot password?</a>
</div>

<button
size="m"
tuiButton
[style.width]="'100%'"
>
Login
</button>
<div class="or">
<hr class="line" />
<p
tuiSubtitle
class="tui-space_top-0 tui-space_bottom-0"
>
or
</p>
<hr class="line" />
</div>
<p class="tui-space_top-2 tui-space_bottom-2 icons-title">Login with</p>
<div class="icons">
<button
appearance="icon"
tuiButton
class="iconLogin"
>
<img
alt=""
src="./google.svg"
class="iconLogin"
/>
</button>
<button
appearance="icon"
tuiButton
class="iconLogin"
>
<img
alt=""
src="./github-mark.svg"
class="iconLogin"
/>
</button>
<button
appearance="icon"
tuiButton
class="iconLogin"
>
<img
alt=""
src="./apple.svg"
class="iconLogin"
/>
</button>
</div>
<a
tuiLink
class="center"
[style.margin-top]="'0.5rem'"
>
Don't have an account?
<span [style.font-weight]="'500'">Sign up</span>
</a>
</form>
</div>
68 changes: 68 additions & 0 deletions apps/taiga-lumbermill/src/dashboards/login/login.component.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
:host {
height: calc(100vh - 3rem);
}

.card {
top: 50%;
bottom: 50%;
width: max-content;
margin: auto;
transform: translateY(-50%);
height: max-content;
}

.block-input {
margin-bottom: 0.3rem;
width: 20rem;

@media (max-width: 29rem) {
width: 16rem;
}
}

.center {
margin-left: auto;
margin-right: auto;
text-align: center;
}

form {
display: flex;
flex-direction: column;
align-items: center;
}

.under-password {
display: flex;
justify-content: space-between;
width: 100%;
margin-bottom: 1.5rem;
}

.or {
display: flex;
margin-top: 0.5rem;
width: 100%;
justify-content: center;
align-items: center;
color: var(--tui-text-secondary);
gap: 0.5rem;
}

.line {
flex-grow: 1;
}

.iconLogin {
width: 1.8rem;
height: 1.8rem;
}

.icons {
display: flex;
gap: 1rem;
}

.icons-title {
font-weight: 700;
}
63 changes: 63 additions & 0 deletions apps/taiga-lumbermill/src/dashboards/login/login.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import {CommonModule} from '@angular/common';
import {ChangeDetectionStrategy, Component} from '@angular/core';
import {
FormControl,
FormGroup,
FormsModule,
ReactiveFormsModule,
Validators,
} from '@angular/forms';
import {
TuiAppearance,
TuiButton,
TuiError,
TuiLabel,
TuiLink,
TuiTitle,
} from '@taiga-ui/core';
import {TUI_VALIDATION_ERRORS, TuiCheckbox, TuiFieldErrorPipe} from '@taiga-ui/kit';
import {TuiCardLarge, TuiHeader} from '@taiga-ui/layout';
import {TuiInputModule, TuiInputPasswordModule} from '@taiga-ui/legacy';

@Component({
standalone: true,
selector: 'lmb-login',
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
TuiAppearance,
TuiButton,
TuiCardLarge,
TuiCheckbox,
TuiError,
TuiFieldErrorPipe,
TuiHeader,
TuiInputModule,
TuiInputPasswordModule,
TuiLabel,
TuiLink,
TuiTitle,
],
templateUrl: './login.component.html',
styleUrl: './login.component.less',
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
{
provide: TUI_VALIDATION_ERRORS,
useValue: {
required: "Value can't be empty",
email: 'Value should be email',
},
},
],
})
export class LoginComponent {
protected readonly form = new FormGroup({
email: new FormControl('', [Validators.required, Validators.email]),
password: new FormControl('', [Validators.required]),
rememberMe: new FormControl(false),
});

protected onSubmit(): void {}
MishaZhem marked this conversation as resolved.
Show resolved Hide resolved
}
Loading