clean code & bugfixes

This commit is contained in:
Chneemann 2024-08-03 01:51:10 +02:00
parent 5aca18a217
commit 800b3ced9f
8 changed files with 110 additions and 125 deletions

View file

@ -5,8 +5,6 @@
<p>Enter your email to create or restart your subscription.</p> <p>Enter your email to create or restart your subscription.</p>
</div> </div>
<form <form
id="form"
class="register-form"
#taskForm="ngForm" #taskForm="ngForm"
(ngSubmit)="onSubmit(taskForm, mail)" (ngSubmit)="onSubmit(taskForm, mail)"
onsubmit="return false" onsubmit="return false"
@ -20,7 +18,12 @@
class="custom-input" class="custom-input"
autocomplete="email" autocomplete="email"
[(ngModel)]="authData.mail" [(ngModel)]="authData.mail"
[ngClass]="{ 'error-border': mail.invalid && mail.touched }" [class.error-border]="
(!mail.valid && mail.touched) ||
(mail.touched &&
!isUserEmailValid(authData.mail.toLowerCase()) &&
authData.mail.length > 0)
"
required required
/> />
<div class="error-msg"> <div class="error-msg">

View file

@ -1,4 +1,5 @@
@import "./../../../assets/style/colors.scss"; @import "./../../../assets/style/colors.scss";
@import "./../../../assets/style/form.scss";
section { section {
display: flex; display: flex;
@ -38,10 +39,8 @@ section {
} }
} }
.register-form { form {
display: flex; flex-direction: row;
align-items: center;
justify-content: space-between;
position: relative; position: relative;
width: 500px; width: 500px;
padding: 24px; padding: 24px;
@ -49,43 +48,22 @@ section {
width: 70%; width: 70%;
padding: 12px 18px; padding: 12px 18px;
margin: 8px 0; margin: 8px 0;
box-sizing: border-box; color: $white;
background: transparent;
border: 2px solid $white; border: 2px solid $white;
border-radius: 24px; border-radius: 24px;
font-size: 18px; font-size: 18px;
font-weight: 400;
transition: background-color 250ms ease-in-out, color 250ms ease-in-out,
border-color 250ms ease-in-out;
&::placeholder { &::placeholder {
color: rgba($white, 0.6); color: rgba($white, 0.6);
} }
&:focus {
outline: none;
background-color: rgba($white, 0.1);
}
} }
.error-border { .error-border {
border: 2px solid $red; border: 2px solid $red;
color: $red;
&::placeholder {
color: $red;
}
} }
} }
.error-msg { .error-msg {
display: flex;
align-items: center;
justify-content: center;
position: absolute; position: absolute;
bottom: 0; bottom: 0;
height: 24px;
padding: 6px; padding: 6px;
width: 62%; width: 62%;
p {
color: $red;
font-size: 12px !important;
font-weight: 400 !important;
}
} }

View file

@ -2,8 +2,6 @@
<div class="content"> <div class="content">
<div class="headline">Log in</div> <div class="headline">Log in</div>
<form <form
id="form"
class="login-form"
#loginForm="ngForm" #loginForm="ngForm"
(ngSubmit)="onSubmit(loginForm)" (ngSubmit)="onSubmit(loginForm)"
onsubmit="return false" onsubmit="return false"
@ -56,14 +54,32 @@
<p>Password is too short, min 6 characters</p> <p>Password is too short, min 6 characters</p>
} } } }
</div> </div>
<div class="checkbox">
<input
type="checkbox"
id="checkbox"
name="checkbox"
#checkbox
[(ngModel)]="authData.checkbox"
/>
<label for="checkbox">Remember me</label>
</div>
<app-btn-large <app-btn-large
[value]="'Log in'" [value]="'Log in'"
[disabled]=" [disabled]="
!checkbox.checked ||
!authData.mail || !authData.mail ||
(!isUserEmailValid(authData.mail) && authData.mail.length > 0) || (!isUserEmailValid(authData.mail) && authData.mail.length > 0) ||
!password.valid !password.valid
" "
></app-btn-large> ></app-btn-large>
</form> </form>
<div class="footer">
<a routerLink="/forgot-password">Forgot password?</a>
<div class="footer-content">
<p>New to Videoflix?</p>
<a routerLink="/register">Sign Up now</a>
</div>
</div>
</div> </div>
</section> </section>

View file

@ -1,4 +1,5 @@
@import "./../../../../assets/style/colors.scss"; @import "./../../../../assets/style/colors.scss";
@import "./../../../../assets/style/form.scss";
section { section {
display: flex; display: flex;
@ -26,6 +27,7 @@ section {
padding: 43px 56px; padding: 43px 56px;
border-radius: 48px; border-radius: 48px;
background-color: $white; background-color: $white;
position: relative;
.headline { .headline {
font-size: 48px; font-size: 48px;
font-weight: 700; font-weight: 700;
@ -37,59 +39,48 @@ section {
} }
} }
.error-msg { .checkbox {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; width: 90%;
height: 24px; height: 24px;
padding: 6px; input {
width: 120%; width: 16px;
p { height: 16px;
color: $red; margin: 12px;
font-size: 12px !important;
font-weight: 400 !important;
}
a {
color: $red;
text-decoration: underline;
cursor: pointer;
&:hover {
text-decoration: none;
} }
label {
width: fit-content;
font-size: 16px;
font-weight: 400;
color: $black;
} }
} }
.login-form { .footer {
display: flex; position: absolute;
flex-direction: column; bottom: 43px;
align-items: center; left: 0;
justify-content: space-between; right: 0;
input { a {
width: 90%;
padding: 12px 18px;
margin: 8px 0;
box-sizing: border-box;
background: transparent;
color: $blue;
border: 1px solid $blue;
border-radius: 12px;
font-size: 18px; font-size: 18px;
font-weight: 400; font-weight: 700;
transition: background-color 250ms ease-in-out, color 250ms ease-in-out, color: $blue;
border-color 250ms ease-in-out; text-decoration: none;
&::placeholder { cursor: pointer;
color: rgba($blue, 0.6); &:hover {
} text-decoration: underline;
&:focus {
outline: none;
background-color: rgba($white, 0.1);
} }
} }
.error-border { .footer-content {
border: 1px solid $red; display: flex;
color: $red; justify-content: center;
&::placeholder { margin-top: 24px;
color: $red; gap: 24px;
p {
font-size: 18px;
font-weight: 700;
color: $black;
} }
} }
} }

View file

@ -14,6 +14,7 @@ export class LoginComponent {
authData = { authData = {
mail: '', mail: '',
password: '', password: '',
checkbox: false,
send: false, send: false,
}; };

View file

@ -14,8 +14,6 @@
</div> </div>
} @else { } @else {
<form <form
id="form"
class="register-form"
#registerForm="ngForm" #registerForm="ngForm"
(ngSubmit)="onSubmit(registerForm)" (ngSubmit)="onSubmit(registerForm)"
onsubmit="return false" onsubmit="return false"

View file

@ -1,4 +1,5 @@
@import "./../../../../assets/style/colors.scss"; @import "./../../../../assets/style/colors.scss";
@import "./../../../../assets/style/form.scss";
section { section {
display: flex; display: flex;
@ -55,52 +56,3 @@ section {
} }
} }
} }
.error-msg {
display: flex;
align-items: center;
justify-content: center;
height: 24px;
padding: 6px;
width: 120%;
p {
color: $red;
font-size: 12px !important;
font-weight: 400 !important;
}
}
.register-form {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
input {
width: 90%;
padding: 12px 18px;
margin: 8px 0;
box-sizing: border-box;
background: transparent;
color: $blue;
border: 1px solid $blue;
border-radius: 12px;
font-size: 18px;
font-weight: 400;
transition: background-color 250ms ease-in-out, color 250ms ease-in-out,
border-color 250ms ease-in-out;
&::placeholder {
color: rgba($blue, 0.6);
}
&:focus {
outline: none;
background-color: rgba($white, 0.1);
}
}
.error-border {
border: 1px solid $red;
color: $red;
&::placeholder {
color: $red;
}
}
}

View file

@ -0,0 +1,46 @@
form {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
input {
width: 90%;
padding: 12px 18px;
box-sizing: border-box;
background: transparent;
color: $blue;
border: 1px solid $blue;
border-radius: 12px;
font-size: 18px;
font-weight: 400;
transition: background-color 250ms ease-in-out, color 250ms ease-in-out,
border-color 250ms ease-in-out;
&::placeholder {
color: rgba($blue, 0.6);
}
&:focus {
outline: none;
background-color: rgba($white, 0.1);
}
}
.error-border {
border: 1px solid $red;
color: $red;
&::placeholder {
color: $red;
}
}
}
.error-msg {
display: flex;
align-items: center;
justify-content: center;
height: 24px;
padding: 9px;
p {
color: $red;
font-size: 12px !important;
font-weight: 400 !important;
}
}