Merge pull request #46 from HideyoshiNakazone/improving-ui

Improving UI  - Better Header Implementation
This commit is contained in:
2023-10-23 13:01:30 -03:00
committed by GitHub
8 changed files with 79 additions and 52 deletions

View File

@@ -30,7 +30,7 @@
align-items: center;
margin: 0;
font-size: 20px;
font-weight: 400;
font-weight: 500;
color: #555555;
}

View File

@@ -15,43 +15,21 @@
</div>
<div #management>
<ul class="user-management" *ngIf="!this.user">
<li class="dropdown-item" (click)="onLoginOptionClicked()">
<li *ngFor="let option of mainOptions"
class="dropdown-item" (click)=option.callback()>
<div class="icon-box">
<fa-icon class="fas fa-user" [icon]="userIcon"></fa-icon>
<fa-icon [icon]="option.icon"></fa-icon>
</div>
<p>Login</p>
</li>
<li class="dropdown-item" (click)="onSignUpOptionClick()">
<div class="icon-box">
<fa-icon class="fas fa-edit" [icon]="editIcon"></fa-icon>
</div>
<p>Sign up</p>
<p>{{option.text}}</p>
</li>
</ul>
<ul class="user-management" *ngIf="this.user">
<li class="dropdown-item" (click)="onMyProfileClicked()">
<li *ngFor="let option of userOptions"
class="dropdown-item" (click)=option.callback()>
<div class="icon-box">
<fa-icon class="fas fa-user" [icon]="userIcon"></fa-icon>
<fa-icon [icon]="option.icon"></fa-icon>
</div>
<p>My Profile</p>
</li>
<li class="dropdown-item" (click)="onHelpClicked()">
<div class="icon-box">
<fa-icon
class="fas fa-question-circle"
[icon]="questionCircleIcon"
></fa-icon>
</div>
<p>Help</p>
</li>
<li class="dropdown-item" (click)="onLogout()">
<div class="icon-box">
<fa-icon
class="fas fa-sign-out-alt"
[icon]="signOutAltIcon"
></fa-icon>
</div>
<p>Logout</p>
<p>{{option.text}}</p>
</li>
</ul>
</div>

View File

@@ -17,7 +17,7 @@ import {
} from '@angular/core';
import {
faEdit,
faQuestionCircle,
faQuestionCircle, faSignIn,
faSignOutAlt,
faUser,
} from '@fortawesome/free-solid-svg-icons';
@@ -27,6 +27,7 @@ import { User } from '../../shared/model/user/user.model';
import UserChecker from '../../shared/model/user/user.checker';
import { HelpComponent } from '../header-popup/help/help.component';
import { MyProfileComponent } from '../header-popup/my-profile/my-profile.component';
import {IconDefinition} from "@fortawesome/free-regular-svg-icons";
@Component({
selector: 'app-header-dropdown',
@@ -52,11 +53,41 @@ import { MyProfileComponent } from '../header-popup/my-profile/my-profile.compon
],
})
export class HeaderDropdownComponent implements OnInit, OnDestroy {
userIcon = faUser;
mainOptions: { text: string, icon: IconDefinition, callback: () => void }[] = [
{
text: 'Login',
icon: faUser,
callback: () => this.onLoginOptionClicked(),
},
{
text: 'Sign Up',
icon: faSignIn,
callback: () => this.onSignUpOptionClick(),
},
{
text: 'Help',
icon: faQuestionCircle,
callback: () => this.onHelpClicked(),
}
];
editIcon = faEdit;
questionCircleIcon = faQuestionCircle;
userOptions: { text: string, icon: IconDefinition, callback: () => void }[] = [
{
text: 'My Profile',
icon: faUser,
callback: () => this.onMyProfileClicked(),
},
{
text: 'Help',
icon: faQuestionCircle,
callback: () => this.onHelpClicked(),
},
{
text: 'Logout',
icon: faSignOutAlt,
callback: () => this.onLogout(),
}
];
signOutAltIcon = faSignOutAlt;

View File

@@ -2,7 +2,7 @@
<div class="nav-links">
<ul>
<li
*ngFor="let nav of navLink; let i = index"
*ngFor="let page of pages; let i = index"
[@animateSliderItem]="{
value: itemStatus,
params: {
@@ -11,8 +11,8 @@
}
}"
>
<a [routerLink]="nav.link">
{{ nav.page }}
<a [routerLink]="page.route">
{{ page.name }}
</a>
</li>
</ul>
@@ -25,8 +25,8 @@
[@animateSliderItem]="{
value: itemStatus,
params: {
fadeInTime: 0.6 + (navLink.length + 1) / 20,
fadeOutTime: 0.6 - (navLink.length + 1) / 10
fadeInTime: 0.6 + (pages.length + 1) / 20,
fadeOutTime: 0.6 - (pages.length + 1) / 10
}
}"
#profile

View File

@@ -1,6 +1,7 @@
import {
Component,
EventEmitter,
Input,
OnDestroy,
OnInit,
Output,
@@ -23,12 +24,8 @@ export class NavSliderComponent
{
userIcon = faUser;
navLink = [
{ page: 'Home', link: '/home' },
{ page: 'Work', link: '/home' },
{ page: 'Contact', link: '/home' },
{ page: 'About', link: '/home' },
];
@Input()
pages!: { name: string; route: string }[];
loggedUser!: User | null;

View File

@@ -13,6 +13,7 @@
top: 0;
left: 0;
display: flex;
position: static;
width: 100%;
background-color: #2e2e2e;
height: 10vh;
@@ -125,7 +126,7 @@ app-header-slider {
letter-spacing: 3px;
color: #ffffff;
font-weight: 500;
font-size: 16px;
font-size: 20px;
}
.profile {

View File

@@ -7,10 +7,9 @@
</div>
<div class="nav-links">
<ul class="link-container">
<li><a routerLink="/home">Home</a></li>
<li><a routerLink="/home">Work</a></li>
<li><a routerLink="/home">Contact</a></li>
<li><a routerLink="/home">About</a></li>
<li *ngFor="let page of pages">
<a [routerLink]="page.route">{{ page.name }}</a>
</li>
</ul>
</div>
@@ -64,6 +63,7 @@
<app-nav-slider
[state]="navSliderStatus"
(profileButtonClicked)="profileButtonClicked()"
[pages]="pages"
>
</app-nav-slider>
</app-header-slider>

View File

@@ -23,6 +23,12 @@ import { MyProfileComponent } from './header-popup/my-profile/my-profile.compone
styleUrls: ['./header.component.css'],
})
export class HeaderComponent implements OnInit, OnDestroy {
pages: { name: string; route: string }[] = [
{ name: 'Home', route: '/home' },
{ name: 'Projects', route: '/home' },
{ name: 'Contact', route: '/home' },
];
userIcon = faUser;
profileDropdownState: boolean = false;
@@ -30,6 +36,7 @@ export class HeaderComponent implements OnInit, OnDestroy {
signupPopupState: boolean = false;
navSliderStatus: boolean = false;
userSliderStatus: boolean = false;
@ViewChild('profileBtn')
@@ -97,6 +104,7 @@ export class HeaderComponent implements OnInit, OnDestroy {
public closeDropdown(): void {
this.profileDropdownState = false;
}
public loginPopupStateChange(state: boolean): void {
if (state) {
this.createLoginPopup();
@@ -179,6 +187,12 @@ export class HeaderComponent implements OnInit, OnDestroy {
this.myProfileComponent.instance.state = true;
this.myProfileComponent.instance.user = this.loggedUser;
this.myProfileComponent.instance.ignoreClickOutside = [
this.profileBtnElementRef,
this.profileDropdownElementRef,
this.userElementRef,
].map((element) => element.nativeElement);
this.myProfileComponent.instance.stateChange.subscribe((state) => {
if (!state) {
this.closeMyProfilePopup();
@@ -195,6 +209,12 @@ export class HeaderComponent implements OnInit, OnDestroy {
this.viewContainerRef.createComponent(HelpComponent);
this.helpComponent.instance.state = true;
this.helpComponent.instance.ignoreClickOutside = [
this.profileBtnElementRef,
this.profileDropdownElementRef,
this.userElementRef,
].map((element) => element.nativeElement);
this.helpComponent.instance.stateChange.subscribe((state) => {
if (!state) {
this.closeHelpPopup();