mirror of
https://git.zavage.net/Zavage-Software/skrill-frontend.git
synced 2025-01-18 02:36:34 -07:00
build: working complete nav with routes, unstyled
This commit is contained in:
parent
cb7bc56e01
commit
7d981250ec
@ -11,6 +11,7 @@ import { HomeComponent } from './home-component/home.component';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { MainNavigationComponent } from './main-navigation/main-navigation.component';
|
||||
import { DropdownNavButtonComponent } from './dropdown-nav-button/dropdown-nav-button.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@ -22,7 +23,13 @@ import { MainNavigationComponent } from './main-navigation/main-navigation.compo
|
||||
TranslocoRootModule,
|
||||
RouterModule.forRoot([{ path: '', component: ScoutingCryptoComponent }]),
|
||||
],
|
||||
declarations: [ScoutingCryptoComponent, HomeComponent, AppComponent, MainNavigationComponent],
|
||||
declarations: [
|
||||
ScoutingCryptoComponent,
|
||||
HomeComponent,
|
||||
AppComponent,
|
||||
MainNavigationComponent,
|
||||
DropdownNavButtonComponent,
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent],
|
||||
})
|
||||
|
@ -0,0 +1,14 @@
|
||||
<div
|
||||
ngbDropdown
|
||||
#myDrop="ngbDropdown"
|
||||
(mouseenter)="onMouseEnter()"
|
||||
(mouseleave)="onMouseLeave()"
|
||||
class="d-inline-block"
|
||||
>
|
||||
<button class="btn btn-outline-primary" ngbDropdownToggle>{{ buttonLabel }}</button>
|
||||
<div ngbDropdownMenu>
|
||||
<a *ngFor="let item of items" ngbDropdownItem [routerLink]="item.route">
|
||||
{{ item.label }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
26
src/app/dropdown-nav-button/dropdown-nav-button.component.ts
Normal file
26
src/app/dropdown-nav-button/dropdown-nav-button.component.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { Component, ViewChild, Input } from '@angular/core';
|
||||
import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dropdown-nav-button',
|
||||
templateUrl: './dropdown-nav-button.component.html',
|
||||
styleUrl: './dropdown-nav-button.component.css',
|
||||
})
|
||||
export class DropdownNavButtonComponent {
|
||||
@ViewChild('myDrop', { static: false }) myDrop: NgbDropdown;
|
||||
@Input() buttonLabel: string = 'Dropdown'; // Customizable button label
|
||||
@Input() items: { label: string; route: string }[] = [];
|
||||
|
||||
private timeout: number;
|
||||
|
||||
onMouseEnter() {
|
||||
clearTimeout(this.timeout);
|
||||
this.myDrop.open();
|
||||
}
|
||||
|
||||
onMouseLeave() {
|
||||
this.timeout = setTimeout(() => {
|
||||
this.myDrop.close();
|
||||
}, 140);
|
||||
}
|
||||
}
|
@ -1,30 +1,29 @@
|
||||
<nav>
|
||||
<div
|
||||
ngbDropdown
|
||||
class="d-inline-block"
|
||||
#myDrop="ngbDropdown"
|
||||
(mouseenter)="onMouseEnter()"
|
||||
(mouseleave)="onMouseLeave()"
|
||||
<app-dropdown-nav-button
|
||||
buttonLabel="Scouting"
|
||||
[items]="[
|
||||
{ label: 'Crypto', route: '/scouting/crypto' },
|
||||
{ label: 'Stocks', route: '/scouting/stocks' },
|
||||
{ label: 'Indicators', route: '/scouting/indicators' },
|
||||
]"
|
||||
>
|
||||
<button type="button" class="btn btn-outline-warning" id="scouting" ngbDropdownToggle>Scouting</button>
|
||||
<div ngbDropdownMenu aria-labelledby="scouting">
|
||||
<button ngbDropdownItem><a routerLink="/scouting/cypto">Crypto</a></button>
|
||||
<button ngbDropdownItem><a routerLink="/scouting/stocks">Stocks</a></button>
|
||||
<button ngbDropdownItem><a routerLink="/scouting/indicators">Indicators</a></button>
|
||||
</div>
|
||||
</div>
|
||||
</app-dropdown-nav-button>
|
||||
|
||||
<!-- <div ngbDropdown class="d-inline-block"-->
|
||||
<!-- #myDrop="ngbDropdown"-->
|
||||
<!-- (mouseenter)="onMouseEnter()"-->
|
||||
<!-- (mouseleave)="onMouseLeave()"-->
|
||||
<!-- >-->
|
||||
<!-- <button type="button" class="btn btn-outline-warning" id="portfolio" ngbDropdownToggle>-->
|
||||
<!-- Scouting-->
|
||||
<!-- </button>-->
|
||||
<!-- <div ngbDropdownMenu aria-labelledby="portfolio">-->
|
||||
<!-- <button ngbDropdownItem><a routerLink="/portfolio/holdings">Crypto</a></button>-->
|
||||
<!-- <button ngbDropdownItem><a routerLink="/portfolio/orders">Stocks</a></button>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<app-dropdown-nav-button
|
||||
buttonLabel="Portfolio"
|
||||
[items]="[
|
||||
{ label: 'Holdings', route: '/portfolio/holdings' },
|
||||
{ label: 'Orders', route: '/portfolio/orders' },
|
||||
]"
|
||||
>
|
||||
</app-dropdown-nav-button>
|
||||
|
||||
<app-dropdown-nav-button
|
||||
buttonLabel="Trade"
|
||||
[items]="[
|
||||
{ label: 'Holdings', route: '/trade/coinbase' },
|
||||
{ label: 'Alerts', route: '/trade/alerts' },
|
||||
]"
|
||||
>
|
||||
</app-dropdown-nav-button>
|
||||
</nav>
|
||||
|
Loading…
Reference in New Issue
Block a user