more material design

This commit is contained in:
Benedek László 2024-05-11 16:16:48 +02:00
parent 628af48e47
commit da67b5527e
13 changed files with 79 additions and 83 deletions

View File

@ -6,7 +6,9 @@ import { AuthComponent } from './auth.component';
import { ReactiveFormsModule } from '@angular/forms'; import { ReactiveFormsModule } from '@angular/forms';
import { LoginComponent } from './login/login.component'; import { LoginComponent } from './login/login.component';
import { RegisterComponent } from './register/register.component'; import { RegisterComponent } from './register/register.component';
import { MatButtonModule } from '@angular/material/button';
import { MatFormFieldModule } from '@angular/material/form-field';
import {MatInputModule} from '@angular/material/input';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -17,7 +19,10 @@ import { RegisterComponent } from './register/register.component';
imports: [ imports: [
CommonModule, CommonModule,
AuthRoutingModule, AuthRoutingModule,
ReactiveFormsModule ReactiveFormsModule,
MatButtonModule,
MatFormFieldModule,
MatInputModule
] ]
}) })
export class AuthModule { } export class AuthModule { }

View File

@ -1,28 +1,18 @@
<div class="center"> <div class="center">
<form class="outline" [formGroup]="loginForm" (ngSubmit)="login()"> <form class="outline" [formGroup]="loginForm" (ngSubmit)="login()" id="form">
<table> <div class="logo">Quack</div>
<tr> <mat-form-field>
<td> <mat-label>Email</mat-label>
<label for="username">Email:</label> <input matInput type="text" formControlName="email">
</td> </mat-form-field>
<td> <br>
<input type="text" formControlName="email"> <mat-form-field>
</td> <mat-label>Password</mat-label>
</tr> <input matInput type="password" formControlName="password">
<tr> </mat-form-field>
<td> <span>
<label for="password">Password:</label> <button mat-button type="submit">Login</button>
</td> <button mat-button [routerLink]="'/auth/register'">Register</button>
<td> </span>
<input type="password" formControlName="password">
</td>
</tr>
<tr>
<td colspan="2">
<button type="submit">Login</button>
<button [routerLink]="'/auth/register'">Register</button>
</td>
</tr>
</table>
</form> </form>
</div> </div>

View File

@ -0,0 +1,10 @@
mat-form-field {
width: 100%;
}
.logo {
width: 100%;
text-align: center;
font-size: 32px;
margin: 10px 0 20px 0;
}

View File

@ -30,8 +30,8 @@ export class LoginComponent implements OnInit {
this.loginForm.get('password')?.value as String this.loginForm.get('password')?.value as String
) )
.then(() => { this.router.navigateByUrl("/feed") }) .then(() => { this.router.navigateByUrl("/feed") })
.catch(() => { alert("wrong username or password") }); .catch(() => { alert("wrong email or password") });
else else
alert("missing username or password"); alert("missing email or password");
} }
} }

View File

@ -1,45 +1,29 @@
<div class="center"> <div class="center">
<form class="outline" [formGroup]="registerForm" (ngSubmit)="register()"> <form class="outline" [formGroup]="registerForm" (ngSubmit)="register()">
<table> <div class="logo">Register</div>
<tr> <mat-form-field>
<td> <mat-label>Email</mat-label>
<label for="username">Email:</label> <input matInput type="text" formControlName="email">
</td> </mat-form-field>
<td> <br>
<input type="text" formControlName="email"> <mat-form-field>
</td> <mat-label>Username [3+]</mat-label>
</tr> <input matInput type="text" formControlName="username">
<tr> </mat-form-field>
<td> <br>
<label for="username">Username:</label> <mat-form-field>
</td> <mat-label>Password</mat-label>
<td> <input matInput type="password" formControlName="password">
<input type="text" formControlName="username"> </mat-form-field>
</td> <br>
</tr> <mat-form-field>
<tr> <mat-label>Repeat Password</mat-label>
<td> <input matInput type="password" formControlName="rePassword">
<label for="password">Password:</label> </mat-form-field>
</td> <span>
<td> <button mat-button type="submit">Register</button>
<input type="password" formControlName="password"> <button mat-button [routerLink]="'/auth/login'">Login</button>
</td> </span>
</tr>
<tr>
<td>
<label for="rePassword">Repeat password:</label>
</td>
<td>
<input type="password" formControlName="rePassword">
</td>
</tr>
<tr>
<td colspan="2">
<button type="submit">Register</button>
<button [routerLink]="'/auth/login'">Login</button>
</td>
</tr>
</table>
</form> </form>
</div> </div>

View File

@ -0,0 +1,10 @@
mat-form-field {
width: 100%;
}
.logo {
width: 100%;
text-align: center;
font-size: 32px;
margin: 10px 0 20px 0;
}

View File

@ -1,4 +1,4 @@
<app-top-menu (side)="sideMenu.nav?.toggle()"></app-top-menu> <app-top-menu (side)="sideMenu.nav?.toggle()" [title]="'Feed'"></app-top-menu>
<app-side-menu #sideMenu> <app-side-menu #sideMenu>
<div id="main"> <div id="main">
<app-post *ngFor="let post of posts" [post]="post"></app-post> <app-post *ngFor="let post of posts" [post]="post"></app-post>

View File

@ -1,4 +1,4 @@
<app-top-menu (side)="sideMenu.nav?.toggle()"></app-top-menu> <app-top-menu (side)="sideMenu.nav?.toggle()" [title]="'New Post'"></app-top-menu>
<app-side-menu #sideMenu> <app-side-menu #sideMenu>
<div id="main"> <div id="main">
<div class="post-container outline"> <div class="post-container outline">

View File

@ -1,4 +1,4 @@
<app-top-menu (side)="sideMenu.nav?.toggle()"></app-top-menu> <app-top-menu (side)="sideMenu.nav?.toggle()" [title]="'Search users'"></app-top-menu>
<app-side-menu #sideMenu> <app-side-menu #sideMenu>
<div id="main"> <div id="main">
<app-large-user *ngFor="let user of users" [user]="user"></app-large-user> <app-large-user *ngFor="let user of users" [user]="user"></app-large-user>

View File

@ -3,11 +3,11 @@
<mat-icon>menu</mat-icon> <mat-icon>menu</mat-icon>
</button> </button>
Quack {{title != undefined ? title : 'Quack'}}
<span> <span>
<mat-form-field> <mat-form-field>
<mat-label>Search</mat-label> <mat-label>Search users</mat-label>
<input matInput type="text" #search> <input matInput type="text" #search>
<button *ngIf="search.value != ''" matSuffix mat-icon-button (click)="search.value = ''"> <button *ngIf="search.value != ''" matSuffix mat-icon-button (click)="search.value = ''">
<mat-icon>close</mat-icon> <mat-icon>close</mat-icon>

View File

@ -3,20 +3,16 @@ mat-toolbar {
position: fixed; position: fixed;
z-index: 100; z-index: 100;
height: var(--top-menu-height); height: var(--top-menu-height);
padding-top: 10px;
overflow: hidden; overflow: hidden;
button { button {
height: 100%; height: 100%;
aspect-ratio: 1;
} }
span { span {
float: right; float: right;
} padding: 5px;
button {
aspect-ratio: 1;
} }
box-shadow: 0px 3px 15px 0px rgba(0,0,0,0.4); box-shadow: 0px 3px 15px 0px rgba(0,0,0,0.4);

View File

@ -1,4 +1,4 @@
import { Component, EventEmitter, Output } from '@angular/core'; import { Component, EventEmitter, Input, Output } from '@angular/core';
import { MatToolbarModule } from '@angular/material/toolbar'; import { MatToolbarModule } from '@angular/material/toolbar';
import { MatInputModule } from '@angular/material/input'; import { MatInputModule } from '@angular/material/input';
import { MatIconModule } from '@angular/material/icon'; import { MatIconModule } from '@angular/material/icon';
@ -14,6 +14,7 @@ import { RouterModule } from '@angular/router';
styleUrl: './top-menu.component.scss' styleUrl: './top-menu.component.scss'
}) })
export class TopMenuComponent { export class TopMenuComponent {
@Input() title?: String;
@Output() side: EventEmitter<Boolean> = new EventEmitter<Boolean>(); @Output() side: EventEmitter<Boolean> = new EventEmitter<Boolean>();
openSide() { openSide() {

View File

@ -1,4 +1,4 @@
<app-top-menu (side)="sideMenu.nav?.toggle()"></app-top-menu> <app-top-menu (side)="sideMenu.nav?.toggle()" [title]="'Profile'"></app-top-menu>
<app-side-menu #sideMenu> <app-side-menu #sideMenu>
<div id="main"> <div id="main">
<app-large-user [user]="user"></app-large-user> <app-large-user [user]="user"></app-large-user>