Bläddra i källkod

Sidebar UI and added children routes

master
kj1352 3 år sedan
förälder
incheckning
ef9d1ffde0
24 ändrade filer med 316 tillägg och 13 borttagningar
  1. +18
    -2
      src/app/app-routing.module.ts
  2. +9
    -1
      src/app/app.module.ts
  3. +18
    -1
      src/app/dashboard/dashboard.component.html
  4. +80
    -0
      src/app/dashboard/dashboard.component.scss
  5. +17
    -6
      src/app/dashboard/dashboard.component.ts
  6. +1
    -0
      src/app/dashboard/graph/graph.component.html
  7. +0
    -0
      src/app/dashboard/graph/graph.component.scss
  8. +25
    -0
      src/app/dashboard/graph/graph.component.spec.ts
  9. +15
    -0
      src/app/dashboard/graph/graph.component.ts
  10. +1
    -0
      src/app/dashboard/report/report.component.html
  11. +0
    -0
      src/app/dashboard/report/report.component.scss
  12. +25
    -0
      src/app/dashboard/report/report.component.spec.ts
  13. +15
    -0
      src/app/dashboard/report/report.component.ts
  14. +1
    -0
      src/app/dashboard/settings/settings.component.html
  15. +0
    -0
      src/app/dashboard/settings/settings.component.scss
  16. +25
    -0
      src/app/dashboard/settings/settings.component.spec.ts
  17. +15
    -0
      src/app/dashboard/settings/settings.component.ts
  18. +1
    -0
      src/app/dashboard/table/table.component.html
  19. +0
    -0
      src/app/dashboard/table/table.component.scss
  20. +25
    -0
      src/app/dashboard/table/table.component.spec.ts
  21. +15
    -0
      src/app/dashboard/table/table.component.ts
  22. +3
    -1
      src/app/login/login.component.html
  23. +7
    -1
      src/app/login/login.component.scss
  24. +0
    -1
      src/styles.scss

+ 18
- 2
src/app/app-routing.module.ts Visa fil

@@ -1,12 +1,28 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { DashboardComponent } from './dashboard/dashboard.component';
import { GraphComponent } from './dashboard/graph/graph.component';
import { ReportComponent } from './dashboard/report/report.component';
import { SettingsComponent } from './dashboard/settings/settings.component';
import { TableComponent } from './dashboard/table/table.component';
import { LoginComponent } from './login/login.component';

const routes: Routes = [
{ path: '', redirectTo: 'login', pathMatch: 'full' },
{ path: '', redirectTo: 'dashboard', pathMatch: 'full' },
{ path: 'login', component: LoginComponent },
{ path: 'dashboard', component: DashboardComponent },
{ path: 'dashboard', component: DashboardComponent, children: [
{
path: '', pathMatch: 'full', redirectTo: 'graph'
}, {
path: 'graph', component: GraphComponent
}, {
path: 'partners', component: TableComponent
}, {
path: 'report', component: ReportComponent
}, {
path: 'settings', component: SettingsComponent
}
] },
];

@NgModule({


+ 9
- 1
src/app/app.module.ts Visa fil

@@ -6,12 +6,20 @@ import { AppComponent } from './app.component';
import { LoginComponent } from './login/login.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { DashboardComponent } from './dashboard/dashboard.component';
import { GraphComponent } from './dashboard/graph/graph.component';
import { TableComponent } from './dashboard/table/table.component';
import { ReportComponent } from './dashboard/report/report.component';
import { SettingsComponent } from './dashboard/settings/settings.component';

@NgModule({
declarations: [
AppComponent,
LoginComponent,
DashboardComponent
DashboardComponent,
GraphComponent,
TableComponent,
ReportComponent,
SettingsComponent
],
imports: [
BrowserModule,


+ 18
- 1
src/app/dashboard/dashboard.component.html Visa fil

@@ -1 +1,18 @@
<p>dashboard works!</p>
<div class="container">
<section class="sidebar">
<figure class="logo" [routerLink]="'graph'">
<img src="assets/logo.png" alt="cac logo">
</figure>
<nav>
<a [ngClass]="{'active' : currentURL.includes('graph')}" [routerLink]="'graph'"> <span> Dashboard </span> </a>
<a [ngClass]="{'active' : currentURL.includes('partners')}" [routerLink]="'partners'"> <span> All Partners </span> </a>
<a [ngClass]="{'active' : currentURL.includes('report')}" [routerLink]="'report'"> <span> Report </span> </a>
<a [ngClass]="{'active' : currentURL.includes('settings')}" [routerLink]="'settings'"> <span> Settings </span> </a>
</nav>
</section>

<div>
<router-outlet></router-outlet>
</div>
</div>

+ 80
- 0
src/app/dashboard/dashboard.component.scss Visa fil

@@ -0,0 +1,80 @@
$sidebar-width: 240px;

.container {
display: grid;
grid-template-columns: $sidebar-width calc(100% - $sidebar-width);
overflow: hidden;
width: 100vw;
height: 100vh;
}

.sidebar {
border-radius: 0;
height: 100vh;
background-color: var(--primary);

.logo {
width: calc(100% - 20px);
margin: 20px auto;
padding: 20px 40px;
display: block;
cursor: pointer;
background-color: var(--secondary);
border-radius: var(--common-border-radius);

img {
display: block;
width: 100%;
height: 100%;
object-fit: contain;
}
}

nav {
padding: 0 24px;
}

nav a {
display: flex;
align-items: center;
justify-content: flex-start;
margin: 20px 0;
text-decoration: none;
color: white;
font-weight: 500;
height: 60px;
padding: 0 20px;
border-radius: var(--common-border-radius);
font-size: 16px;
letter-spacing: 0.5px;
transition: transform 0.3s, background-color 0.3s, color 0.3s;
position: relative;
overflow: hidden;

&:hover {
color: white;
}

&.active {
transform: translateX(24px);
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
color: white;

&::before {
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: var(--primary);
filter: brightness(0.8);
}

& > * {
position: relative;
}
}
}
}

+ 17
- 6
src/app/dashboard/dashboard.component.ts Visa fil

@@ -1,15 +1,26 @@
import { Component, OnInit } from '@angular/core';
import { NavigationEnd, Router } from '@angular/router';

@Component({
selector: 'app-dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.scss']
selector: 'app-dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.scss']
})
export class DashboardComponent implements OnInit {
currentURL: string = '';

constructor() { }
constructor(
private router: Router
) { }

ngOnInit(): void {
}
ngOnInit(): void {
this.currentURL = this.router.url;

this.router.events.subscribe((val) => {
// see also
if (val instanceof NavigationEnd) {
this.currentURL = val.url;
}
});
}
}

+ 1
- 0
src/app/dashboard/graph/graph.component.html Visa fil

@@ -0,0 +1 @@
<p>graph works!</p>

+ 0
- 0
src/app/dashboard/graph/graph.component.scss Visa fil


+ 25
- 0
src/app/dashboard/graph/graph.component.spec.ts Visa fil

@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { GraphComponent } from './graph.component';

describe('GraphComponent', () => {
let component: GraphComponent;
let fixture: ComponentFixture<GraphComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ GraphComponent ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(GraphComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});

+ 15
- 0
src/app/dashboard/graph/graph.component.ts Visa fil

@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-graph',
templateUrl: './graph.component.html',
styleUrls: ['./graph.component.scss']
})
export class GraphComponent implements OnInit {

constructor() { }

ngOnInit(): void {
}

}

+ 1
- 0
src/app/dashboard/report/report.component.html Visa fil

@@ -0,0 +1 @@
<p>report works!</p>

+ 0
- 0
src/app/dashboard/report/report.component.scss Visa fil


+ 25
- 0
src/app/dashboard/report/report.component.spec.ts Visa fil

@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ReportComponent } from './report.component';

describe('ReportComponent', () => {
let component: ReportComponent;
let fixture: ComponentFixture<ReportComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ReportComponent ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(ReportComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});

+ 15
- 0
src/app/dashboard/report/report.component.ts Visa fil

@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-report',
templateUrl: './report.component.html',
styleUrls: ['./report.component.scss']
})
export class ReportComponent implements OnInit {

constructor() { }

ngOnInit(): void {
}

}

+ 1
- 0
src/app/dashboard/settings/settings.component.html Visa fil

@@ -0,0 +1 @@
<p>settings works!</p>

+ 0
- 0
src/app/dashboard/settings/settings.component.scss Visa fil


+ 25
- 0
src/app/dashboard/settings/settings.component.spec.ts Visa fil

@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { SettingsComponent } from './settings.component';

describe('SettingsComponent', () => {
let component: SettingsComponent;
let fixture: ComponentFixture<SettingsComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ SettingsComponent ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(SettingsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});

+ 15
- 0
src/app/dashboard/settings/settings.component.ts Visa fil

@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-settings',
templateUrl: './settings.component.html',
styleUrls: ['./settings.component.scss']
})
export class SettingsComponent implements OnInit {

constructor() { }

ngOnInit(): void {
}

}

+ 1
- 0
src/app/dashboard/table/table.component.html Visa fil

@@ -0,0 +1 @@
<p>table works!</p>

+ 0
- 0
src/app/dashboard/table/table.component.scss Visa fil


+ 25
- 0
src/app/dashboard/table/table.component.spec.ts Visa fil

@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { TableComponent } from './table.component';

describe('TableComponent', () => {
let component: TableComponent;
let fixture: ComponentFixture<TableComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ TableComponent ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(TableComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});

+ 15
- 0
src/app/dashboard/table/table.component.ts Visa fil

@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-table',
templateUrl: './table.component.html',
styleUrls: ['./table.component.scss']
})
export class TableComponent implements OnInit {

constructor() { }

ngOnInit(): void {
}

}

+ 3
- 1
src/app/login/login.component.html Visa fil

@@ -1,7 +1,9 @@
<div class="container">

<div class="card-holder">
<img src="assets/logo.png" alt="cac logo">
<figure class="logo">
<img src="assets/logo.png" alt="cac logo">
</figure>

<section class="card">



+ 7
- 1
src/app/login/login.component.scss Visa fil

@@ -10,9 +10,15 @@
.card-holder {
width: 30vw;
img {
.logo {
display: block;
width: 150px;
margin: 16px auto;

img {
display: block;
object-fit: contain;
}
}
}



+ 0
- 1
src/styles.scss Visa fil

@@ -12,7 +12,6 @@
:root {
--primary: #2a7a99;
--secondary: #f5e461;
--secondary-contrast: #f5e461;
--primary-text: #5c5c5c;
--secondary-text: #7b7b7b;
--input-background: #f6f6f6;


Laddar…
Avbryt
Spara