Skip to content

Commit

Permalink
Factorisation des links
Browse files Browse the repository at this point in the history
  • Loading branch information
Babali42 committed Jan 28, 2024
1 parent a468593 commit 0ea0105
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 34 deletions.
38 changes: 4 additions & 34 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,13 @@
<div class="flex column left-menu" *ngIf="!isMobileDisplay">
<div class="header"> DRUMS<br> PATTERN<br> LIBRARY</div>
<div class="flex menu">
<a class="button" routerLink="/techno">Techno</a>
<a class="button" routerLink="/drum-n-bass">Drum & Bass</a>
<a class="button" routerLink="/garage">Garage - 2 step</a>
<a class="button" routerLink="/psytrance">Psytrance</a>
<a class="button" routerLink="/metal">Metal</a>
<a class="button" routerLink="/rock">Rock</a>
<a class="button" routerLink="/rock-variation">Rock variation</a>
<a class="button" routerLink="/half-time-groove">Half time groove</a>
<a class="button" [routerLink]="link.link" *ngFor="let link of links">{{ link.label }}</a>
</div>
</div>
<div *ngIf="isMobileDisplay">
<div class="header nowrap">DRUMS PATTERN LIBRARY</div>
<div class="flex" style="width: 100%; scroll: auto">
<div>
<a class="button" routerLink="/techno">Techno</a>
</div>
<div>
<a class="button" routerLink="/drum-n-bass">Drum & Bass</a>
</div>
<div>
<a class="button" routerLink="/garage">Garage - 2 step</a>
</div>
<div>
<a class="button" routerLink="/psytrance">Psytrance</a>
</div>
<div>
<a class="button" routerLink="/metal">Metal</a>
</div>
<div>
<a class="button" routerLink="/rock">Rock</a>
</div>
<div>
<a class="button" routerLink="/rock-variation">Rock variation</a>
</div>
<div>
<a class="button" routerLink="/half-time-groove">Half time groove</a>
</div>
<div class="header-mobile">DRUMS PATTERN LIBRARY</div>
<div class="flex mobile-menu">
<a class="item" [routerLink]="link.link" *ngFor="let link of links">{{ link.label }}</a>
</div>
</div>
<div class="content">
Expand Down
24 changes: 24 additions & 0 deletions src/app/app.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,27 @@
.nowrap{
white-space: nowrap;
}

.mobile-menu {
width: 100%;
overflow-x: auto;
gap: 5px;

a {
all: unset;
}

.item{
white-space: nowrap;
background-color: darkgrey;
color: white;
border-radius: 15px;
padding: 10px;
}
}

.header-mobile{
font-size: 30px;
width: 100%;
text-align: center;
}
12 changes: 12 additions & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Component, OnInit} from '@angular/core';
import {BreakpointObserver, Breakpoints} from '@angular/cdk/layout';
import {Link} from "./models/link";

@Component({
selector: 'app-root',
Expand All @@ -8,6 +9,17 @@ import {BreakpointObserver, Breakpoints} from '@angular/cdk/layout';
})
export class AppComponent implements OnInit {
isMobileDisplay: boolean = true;
links: Link[] = [
new Link("Techno", "/techno"),
new Link("Drum & Bass", "/drum-n-bass"),
new Link("Garage - 2 step", "/garage"),
new Link("Psytrance", "/psytrance"),
new Link("Metal", "/metal"),
new Link("Rock", "/rock"),
new Link("Rock variation", "/rock-variation"),
new Link("Half time groove", "/half-time-groove")
]

constructor(private responsive: BreakpointObserver) {
}

Expand Down
9 changes: 9 additions & 0 deletions src/app/models/link.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export class Link {
label: string;
link: string;

constructor(label: string, link: string) {
this.label = label;
this.link = link;
}
}

0 comments on commit 0ea0105

Please sign in to comment.