update design

This commit is contained in:
Chneemann 2024-03-30 13:24:03 +01:00
parent 8aadd146b8
commit 3889bf0bda
9 changed files with 137 additions and 24 deletions

View file

@ -2,7 +2,7 @@
<app-sidebar></app-sidebar> <app-sidebar></app-sidebar>
<main> <main>
<app-header></app-header> <app-header></app-header>
<div class="content"> <div class="main-content">
<router-outlet></router-outlet> <router-outlet></router-outlet>
</div> </div>
</main> </main>

View file

@ -28,7 +28,7 @@ app-header {
background-color: var(--white); background-color: var(--white);
} }
.content { .main-content {
width: calc(100% - 128px); width: calc(100% - 128px);
min-width: calc(100vw - 232px - 64px); min-width: calc(100vw - 232px - 64px);
height: 100vh; height: 100vh;
@ -38,9 +38,7 @@ app-header {
} }
@media screen and (max-width: 910px) { @media screen and (max-width: 910px) {
.content { .main-content {
display: flex;
justify-content: center;
width: calc(100vw - 64px); width: calc(100vw - 64px);
height: calc(100vh - 240px); height: calc(100vh - 240px);
padding: 32px; padding: 32px;
@ -54,9 +52,7 @@ app-header {
} }
@media screen and (max-width: 450px) { @media screen and (max-width: 450px) {
.content { .main-content {
display: flex;
justify-content: center;
width: calc(100vw - 32px); width: calc(100vw - 32px);
padding: 32px 16px; padding: 32px 16px;
} }

View file

@ -1,8 +1,14 @@
<section> <section>
<div class="headerline"> <div class="header">
<div class="title">Contacts</div> <div class="headerline">
<div class="blue-bar"></div> <div class="title">Contacts</div>
<div class="metrics-txt">Better with a team</div> <div class="blue-bar"></div>
<div class="metrics-txt">Better with a team</div>
</div>
<img
(click)="closeUserDetails()"
src="./../../../../assets/img/arrow-left.svg"
/>
</div> </div>
@if (currentUserId) { @if (currentUserId) {
<div <div
@ -11,7 +17,7 @@
'animation-coming-in': currentUserId 'animation-coming-in': currentUserId
}" }"
> >
<div class="header"> <div class="content">
<div <div
class="circle" class="circle"
[ngStyle]="{ [ngStyle]="{

View file

@ -3,9 +3,25 @@ section {
top: -64px; top: -64px;
left: 339px; left: 339px;
width: calc(100vw - 747px); width: calc(100vw - 747px);
min-height: calc(100vh - 128px); min-height: calc(100vh - 208px);
padding: 64px 48px 48px 48px; padding: 64px 48px 48px 48px;
box-shadow: 2px 0px 2px 0px rgba(0, 0, 0, 0.1); }
.header {
display: flex;
justify-content: space-between;
align-items: center;
img {
width: 32px;
height: 32px;
cursor: pointer;
&:hover {
width: 36px;
height: 36px;
background-color: var(--light-gray);
border-radius: 18px;
}
}
} }
.headerline { .headerline {
@ -30,7 +46,7 @@ section {
} }
} }
.header { .content {
display: flex; display: flex;
align-items: center; align-items: center;
margin-top: 48px; margin-top: 48px;
@ -175,6 +191,51 @@ section {
@media screen and (max-width: 1150px) { @media screen and (max-width: 1150px) {
section { section {
display: none; position: unset;
box-shadow: unset;
width: calc(100vw - 312px);
padding: 0;
}
.header {
padding-right: 64px;
}
}
@media screen and (max-width: 1150px) {
section {
width: calc(100vw - 296px);
}
}
@media screen and (max-width: 910px) {
section {
width: calc(100vw - 48px);
min-height: calc(100vh - 240px);
}
.header {
padding-right: 0;
}
}
@media screen and (max-width: 450px) {
.btns {
display: none;
}
section {
width: calc(100vw - 36px);
}
.headerline {
.title {
font-size: 47px;
font-weight: 700;
}
.metrics-txt {
font-size: 20px;
font-weight: 400;
}
} }
} }

View file

@ -1,7 +1,8 @@
import { Component, Input } from '@angular/core'; import { Component, EventEmitter, Input, Output } from '@angular/core';
import { UserService } from '../../../services/user.service'; import { UserService } from '../../../services/user.service';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { ContactsComponent } from '../contacts.component'; import { ContactsComponent } from '../contacts.component';
import { Router } from '@angular/router';
@Component({ @Component({
selector: 'app-contact-detail', selector: 'app-contact-detail',
@ -11,7 +12,11 @@ import { ContactsComponent } from '../contacts.component';
styleUrl: './contact-detail.component.scss', styleUrl: './contact-detail.component.scss',
}) })
export class ContactDetailComponent { export class ContactDetailComponent {
@Input() currentUserId: string = ''; @Input() currentUserId!: string;
constructor(public userService: UserService) {} constructor(public userService: UserService, private router: Router) {}
closeUserDetails() {
this.router.navigate(['contacts']);
}
} }

View file

@ -1,5 +1,8 @@
<section> <section>
<div class="left-frame"> <div
class="left-frame"
[ngClass]="{ 'd-none': !showAllUsers && currentUserId != undefined }"
>
<button class="btn" type="submit"> <button class="btn" type="submit">
<div class="btn-inside"> <div class="btn-inside">
<span>Add new contact</span> <span>Add new contact</span>
@ -41,5 +44,8 @@
} } } }
</div> </div>
</div> </div>
<app-contact-detail [currentUserId]="currentUserId"></app-contact-detail> <app-contact-detail
[ngClass]="{ 'd-none': !showAllUsers && currentUserId == undefined }"
[currentUserId]="currentUserId"
></app-contact-detail>
</section> </section>

View file

@ -2,6 +2,10 @@ section {
position: relative; position: relative;
} }
.d-none {
display: none;
}
.btn-inside { .btn-inside {
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -135,7 +139,22 @@ section {
top: 96px; top: 96px;
left: 0px; left: 0px;
width: 100vw; width: 100vw;
min-height: calc(100vh - 207px);
background-color: var(--bgContent); background-color: var(--bgContent);
} }
} }
@media screen and (max-width: 450px) {
.left-frame {
padding: 0;
}
.btn {
display: none;
}
.first-letter {
&:first-child {
margin-top: 0;
}
}
}

View file

@ -1,4 +1,4 @@
import { Component } from '@angular/core'; import { Component, EventEmitter, HostListener, Output } from '@angular/core';
import { UserService } from '../../services/user.service'; import { UserService } from '../../services/user.service';
import { User } from '../../interfaces/user.interface'; import { User } from '../../interfaces/user.interface';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
@ -16,12 +16,14 @@ export class ContactsComponent {
allUsers: User[] = []; allUsers: User[] = [];
usersFirstLetter: string[] = []; usersFirstLetter: string[] = [];
usersByFirstLetter: { [key: string]: string[] } = {}; usersByFirstLetter: { [key: string]: string[] } = {};
showAllUsers!: boolean;
currentUserId: string = ''; currentUserId: string = '';
constructor(public userService: UserService, private route: ActivatedRoute) {} constructor(public userService: UserService, private route: ActivatedRoute) {}
ngOnInit(): void { ngOnInit(): void {
this.routeUserId(); this.routeUserId();
this.onResize();
} }
routeUserId() { routeUserId() {
@ -32,6 +34,16 @@ export class ContactsComponent {
} }
} }
@HostListener('window:resize', ['$event'])
onResize() {
if (window.innerWidth <= 1150 && this.currentUserId != '') {
this.showAllUsers = false;
} else {
this.showAllUsers = true;
}
console.log(this.showAllUsers);
}
loadAllUserWithoutGuest(): User[] { loadAllUserWithoutGuest(): User[] {
return this.userService return this.userService
.getAllUsers() .getAllUsers()

View file

@ -179,6 +179,14 @@ section {
} }
} }
@media screen and (max-width: 910px) {
section {
display: flex;
flex-direction: column;
align-items: center;
}
}
@media screen and (max-width: 700px) { @media screen and (max-width: 700px) {
.header { .header {
flex-direction: column; flex-direction: column;