Skip to content

Commit

Permalink
Merge pull request #6 from axherrm/feat/navbar-2
Browse files Browse the repository at this point in the history
feat: Navbar
  • Loading branch information
axherrm authored Jan 22, 2024
2 parents 1e57052 + 09978f3 commit 5a5fb24
Show file tree
Hide file tree
Showing 13 changed files with 409 additions and 63 deletions.
86 changes: 44 additions & 42 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,54 +19,56 @@
</div>

<div class="progressbar-container"><div #progress_bar class="progressbar"></div></div>
<sidebar #sidebar [sections]="dataService.languagePack.sections" [languagesMenuItems]="dataService.languagesMenuItems"></sidebar>

<div #lang_selector id="lang-selector">
<p-speedDial [model]="dataService.languagesMenuItems" direction="down" showIcon="pi pi-language" class="language-speed-dial" buttonClassName="language-button"></p-speedDial>
<div id="home-start" style="position:relative; top: -30vh; display: table; height: 130vh; width: 100vw;">
<div style="display: table-cell; vertical-align: middle; text-align: center;">
<h1 id="main-heading" [innerHTML]="dataService.languagePack.heading"></h1>
<h2 id="main-subheading" [innerHTML]="dataService.languagePack.subheading"></h2>
</div>
</div>

<div class="content-container">
<div style="position:relative; top: -30vh; display: table; height: 130vh; width: 100vw;">
<div style="display: table-cell; vertical-align: middle; text-align: center;">
<h1 id="main-heading" [innerHTML]="dataService.languagePack.heading"></h1>
<h2 id="main-subheading" [innerHTML]="dataService.languagePack.subheading"></h2>
</div>
</div>
<div id="perspective-div" style="perspective: 10000px">
<!-- [class.rotated]="sidebar.hovered" -->
<div class="content-container">
<heading-card #education_card id="education-start" [heading]="dataService.languagePack.education" type="light" styleClass="alarm-clock-animated"></heading-card>
<p-timeline id="eduction-tl" [value]="dataService.education" align="alternate" [style]="{'width': '70%', 'display': 'inline-block'}">
<ng-template pTemplate="marker">
<span class="dot"></span>
</ng-template>
<ng-template pTemplate="content" let-educationItem>
<timeline-card type="light" [heading]="educationItem.heading" [subheading]="educationItem.subheading"
[content]="educationItem.content" [bulletPoints]="educationItem.bulletPoints" styleClass="alarm-clock-animated">
</timeline-card>
</ng-template>
<ng-template pTemplate="opposite" let-educationItem>
<p-badge [value]="educationItem.date" size="large" styleClass="timeline-date-dark alarm-clock-animated"></p-badge>
</ng-template>
</p-timeline>

<heading-card #education_card [heading]="dataService.languagePack.education" type="light" styleClass="alarm-clock-animated"></heading-card>
<p-timeline id="eduction-tl" [value]="dataService.education" align="alternate" [style]="{'width': '70%', 'display': 'inline-block'}">
<ng-template pTemplate="marker">
<span class="dot"></span>
</ng-template>
<ng-template pTemplate="content" let-educationItem>
<timeline-card type="light" [heading]="educationItem.heading" [subheading]="educationItem.subheading"
[content]="educationItem.content" [bulletPoints]="educationItem.bulletPoints" styleClass="alarm-clock-animated">
</timeline-card>
</ng-template>
<ng-template pTemplate="opposite" let-educationItem>
<p-badge [value]="educationItem.date" size="large" styleClass="timeline-date-dark alarm-clock-animated"></p-badge>
</ng-template>
</p-timeline>
<heading-card id="experience-start" [heading]="dataService.languagePack.experience" type="dark" styleClass="alarm-clock-animated"></heading-card>
<p-timeline id="experience-tl" [value]="dataService.experience" align="alternate" [style]="{'width': '70%', 'display': 'inline-block'}">
<ng-template pTemplate="marker">
<span class="dot"></span>
</ng-template>
<ng-template pTemplate="content" let-experienceItem>
<timeline-card type="dark" [heading]="experienceItem.heading" [subheading]="experienceItem.subheading"
[content]="experienceItem.content" [bulletPoints]="experienceItem.skills" styleClass="alarm-clock-animated">
</timeline-card>
</ng-template>
<ng-template pTemplate="opposite" let-experienceItem>
<p-badge [value]="experienceItem.date" size="large" styleClass="timeline-date-light alarm-clock-animated"></p-badge>
</ng-template>
</p-timeline>

<heading-card #experience_card [heading]="dataService.languagePack.experience" type="dark" styleClass="alarm-clock-animated"></heading-card>
<p-timeline id="experience-tl" [value]="dataService.experience" align="alternate" [style]="{'width': '70%', 'display': 'inline-block'}">
<ng-template pTemplate="marker">
<span class="dot"></span>
</ng-template>
<ng-template pTemplate="content" let-experienceItem>
<timeline-card type="dark" [heading]="experienceItem.heading" [subheading]="experienceItem.subheading"
[content]="experienceItem.content" [bulletPoints]="experienceItem.skills" styleClass="alarm-clock-animated">
</timeline-card>
</ng-template>
<ng-template pTemplate="opposite" let-experienceItem>
<p-badge [value]="experienceItem.date" size="large" styleClass="timeline-date-light alarm-clock-animated"></p-badge>
</ng-template>
</p-timeline>
<heading-card id="skills-start" [heading]="dataService.languagePack.skills" type="3" styleClass="alarm-clock-animated"></heading-card>
<div style="width: var(--main-content-width); margin: 0 var(--main-content-side-margin); display: flex; flex-direction: column; flex-wrap: nowrap; gap: 1rem">
<skills-card class="alarm-clock-animated" *ngFor="let skillCategory of dataService.skillCategories" [category]="skillCategory"></skills-card>
</div>

<heading-card [heading]="dataService.languagePack.skills" type="3" styleClass="alarm-clock-animated"></heading-card>
<div style="width: var(--main-content-width); margin: 0 var(--main-content-side-margin); display: flex; flex-direction: column; flex-wrap: nowrap; gap: 1rem">
<skills-card class="alarm-clock-animated" *ngFor="let skillCategory of dataService.skillCategories" [category]="skillCategory"></skills-card>
</div>
<heading-card id="about-start" [heading]="dataService.languagePack.about" type="3" styleClass="alarm-clock-animated"></heading-card>

<div class="spacer" style="width: 100vw; height: 50vh"></div>
<div class="spacer" style="width: 100vw; height: 50vh"></div>
</div>
</div>
</main>
14 changes: 13 additions & 1 deletion src/app/app.component.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@use 'style/language-selector';
@use 'style/lenis';

#background-img {
Expand Down Expand Up @@ -60,6 +59,19 @@
flex-direction: column;
text-align: center;
align-items: center;

// for rotation
position: relative;
transform-style: preserve-3d;
transform-origin: left;
transition: all .6s ease-in-out;
&.rotated {
transition: all .4s ease-in-out;
//transform: rotateY(calc(1 * var(--rotate-angle)));
//transform: rotateX(70deg);
//transform: translateY(-5000px);
//transform: scale(0.6);
}
}

:host ::ng-deep {
Expand Down
22 changes: 14 additions & 8 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import 'js-circle-progress';
import {TimelineCardComponent} from "./components/timeline-card/timeline-card.component";
import {HeadingCardComponent} from "./components/heading-card/heading-card.component";
import {SkillsCardComponent} from "./components/skills-card/skills-card.component";
import {NavbarDotComponent} from "./components/navbar-dot/navbar-dot.component";
import {SidebarComponent} from "./sections/sidebar/sidebar.component";

gsap.registerPlugin(ScrollTrigger);

Expand All @@ -29,7 +31,10 @@ import "./js/lenis.js";
// Custom
TimelineCardComponent,
HeadingCardComponent,
SkillsCardComponent],
SkillsCardComponent,
NavbarDotComponent,
SidebarComponent
],
templateUrl: './app.component.html',
styleUrl: './app.component.scss'
})
Expand All @@ -38,8 +43,9 @@ export class AppComponent {
@ViewChild("backgroundImg", {read: ElementRef}) backgroundImage: ElementRef;
@ViewChild("outest_container", {read: ElementRef}) outestContainer: ElementRef;
@ViewChild("progress_bar", {read: ElementRef}) progressBar: ElementRef;
// @ViewChild("content_container", {read: ElementRef}) contentContainer: ElementRef;
@ViewChild("education_card", {read: ElementRef}) educationCard: ElementRef;
@ViewChild("lang_selector", {read: ElementRef}) langSelector: ElementRef;
@ViewChild("sidebar", {read: ElementRef}) sidebar: ElementRef;

dataService: DataService;

Expand All @@ -51,7 +57,7 @@ export class AppComponent {
}

ngAfterViewInit(): void {
this.addLangButtonAnimation();
this.addSidebarAnimation();
this.addProgressBarAnimation();
// @ts-ignore
for (let el of document.getElementsByClassName("alarm-clock-animated")) {
Expand Down Expand Up @@ -86,7 +92,7 @@ export class AppComponent {
})
}

addLangButtonAnimation() {
addSidebarAnimation() {
const tl: gsap.core.Timeline = gsap.timeline({
scrollTrigger: {
start: "top 90%",
Expand All @@ -99,12 +105,12 @@ export class AppComponent {
.to(this.backgroundImage.nativeElement, {
filter: "blur(2px)"
})
.fromTo(this.langSelector.nativeElement, {
.fromTo(this.sidebar.nativeElement, {
opacity: 0,
ease: "power1.in",
display: "none"
}, {
display: "var(--display-side-elements)",
display: "var(--display-side-elements-flex)",
opacity: 1,
}, "<");
}
Expand All @@ -115,7 +121,7 @@ export class AppComponent {
start: "top bottom",
trigger: el,
end: "center center",
// markers: true, // TODO remove
// markers: true,
scrub: true,
},
defaults: {
Expand All @@ -127,7 +133,7 @@ export class AppComponent {
start: "center center",
trigger: el,
end: "bottom top",
// markers: true, // TODO remove
// markers: true,
scrub: true,
},
defaults: {
Expand Down
1 change: 1 addition & 0 deletions src/app/components/navbar-dot/navbar-dot.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<span [innerHTML]="section.name"></span>
74 changes: 74 additions & 0 deletions src/app/components/navbar-dot/navbar-dot.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
:host {
height: 1.2rem;
width: 1.2rem;
border-radius: 50%;
border: 3px solid rgb(255, 255, 255);
transition: all .6s ease-in-out;
user-select: none;

display: flex;
align-items: center;
justify-content: center;
font-size: 0;

&:not(.extended):hover {
transition: all .1s ease-in-out;
height: 1.5rem;
width: 1.5rem;
border: 5px solid rgb(255, 255, 255);
background: rgba(0, 0, 0, 0.3);
cursor: pointer;
}

&.active:not(.extended) {
background: #e134e8 !important;
}
&.extended {
position: relative;
transition: all .4s ease-in-out;
width: 20rem;
height: 5rem;
margin: 0 3rem;
border-radius: 20px;
//transform: translateX(-4rem);
font-size: 1.3rem;
&.active {
border: 0;
&::before {
// code from: https://dev.to/afif/border-with-gradient-and-radius-387f
content: "";
position: absolute;
inset: 0;
border-radius: 20px;
padding: 5px;
margin: -5px;
background: linear-gradient(to right, #a445b2, #fa4299);
-webkit-mask:
linear-gradient(#fff 0 0) content-box,
linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
}
}
&:hover {
width: 21rem;
margin: 0 1rem;
height: 5.3rem;
font-size: 1.4rem;
background: rgba(0, 0, 0, 0.3);
cursor: pointer;
}
span {
display: block;
}
}
}

span {
display: none;
transition: all .4s ease-in-out;
color: white;
text-align: center;
margin-top: auto;
margin-bottom: auto;
}
56 changes: 56 additions & 0 deletions src/app/components/navbar-dot/navbar-dot.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import {Component, EventEmitter, HostBinding, HostListener, Input, Output} from '@angular/core';
import {Section} from "../../data/model";
import gsap from "gsap";
import {ScrollToPlugin} from "gsap/ScrollToPlugin";

gsap.registerPlugin(ScrollToPlugin)

@Component({
selector: 'navbar-dot',
standalone: true,
imports: [],
templateUrl: './navbar-dot.component.html',
styleUrl: './navbar-dot.component.scss'
})
export class NavbarDotComponent {

@Input({required: true}) section: Section;

// @HostBinding('class.extended')
// @Input()
// extended = false;

@HostBinding('class.active')
@Input()
active = false;

// @Output() hover: EventEmitter<void> = new EventEmitter<void>();

delayTimeout: any;

// @HostListener("mouseenter")
// onMouseover() {
// this.delayTimeout = setTimeout(() => this.hover.emit(), 300);
// }

/**
* In case the hovering stops before delay timeout is over, the hovering is not forwarded.
*/
// @HostListener("mouseleave")
// onMouseleave() {
// clearTimeout(this.delayTimeout);
// }

@HostListener("click")
onClick() {
gsap.to(window, {
duration: 2,
scrollTo: {
y: `#${this.section.id}`,
offsetY: 20,
},
ease: "power1.inOut"
});
}

}
2 changes: 1 addition & 1 deletion src/app/data/data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class DataService {
// @ts-ignore
this.education = educationJson[this.lang];
// @ts-ignore
this.languagePack = generalJson[this.lang];
this.languagePack = new LanguagePack(generalJson[this.lang]);
// @ts-ignore
this.experience = experienceJson[this.lang];
// @ts-ignore
Expand Down
Loading

0 comments on commit 5a5fb24

Please sign in to comment.