Skip to content

Commit 7f76357

Browse files
committed
refactor: src/app
1 parent 6597faa commit 7f76357

19 files changed

+12347
-24
lines changed

package-lock.json

Lines changed: 11685 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/_nav.ts

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,42 @@ export const navItems: NavData[] = [
3838
variant: 'info',
3939
text: 'NEW'
4040
}
41-
}
41+
},
42+
{
43+
name: 'Colors',
44+
url: '/theme/colors',
45+
icon: 'cui-drop'
46+
},
47+
{
48+
name: 'Typography',
49+
url: '/theme/typography',
50+
icon: 'cui-pencil'
51+
},
52+
{
53+
name: 'Pages',
54+
url: '/pages',
55+
icon: 'cui-star',
56+
children: [
57+
{
58+
name: 'Error 404',
59+
url: '/404',
60+
icon: 'cui-star'
61+
},
62+
{
63+
name: 'Error 500',
64+
url: '/500',
65+
icon: 'cui-circle-x'
66+
}
67+
]
68+
},
69+
{
70+
name: 'Disabled',
71+
url: '/dashboard',
72+
icon: 'cui-ban',
73+
badge: {
74+
variant: 'secondary',
75+
text: 'NEW'
76+
},
77+
attributes: { disabled: true },
78+
},
4279
];

src/app/app.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export class AppComponent implements OnInit {
1414
if (!(evt instanceof NavigationEnd)) {
1515
return;
1616
}
17-
window.scrollTo(0, 0);
1817
});
1918
}
2019
}

src/app/app.module.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ import { AppComponent } from './app.component';
1616
// Import containers
1717
import { DefaultLayoutComponent } from './containers';
1818

19+
import { P404Component } from './views/error/404.component';
20+
import { P500Component } from './views/error/500.component';
21+
1922
const APP_CONTAINERS = [
2023
DefaultLayoutComponent
2124
];
@@ -25,7 +28,9 @@ import {
2528
BreadcrumbModule,
2629
HeaderModule,
2730
FooterModule,
31+
NavbarModule,
2832
SidebarModule,
33+
TogglerModule,
2934
} from '@coreui/angular';
3035

3136
// Import routing module
@@ -44,14 +49,18 @@ import { TabsModule } from 'ngx-bootstrap/tabs';
4449
BreadcrumbModule.forRoot(),
4550
FooterModule,
4651
HeaderModule,
52+
NavbarModule,
4753
SidebarModule,
4854
PerfectScrollbarModule,
4955
BsDropdownModule.forRoot(),
5056
TabsModule.forRoot(),
57+
TogglerModule
5158
],
5259
declarations: [
5360
AppComponent,
54-
...APP_CONTAINERS
61+
...APP_CONTAINERS,
62+
P404Component,
63+
P500Component
5564
],
5665
providers: [{
5766
provide: LocationStrategy,

src/app/app.routing.ts

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,28 @@ import { Routes, RouterModule } from '@angular/router';
33

44
// Import Containers
55
import { DefaultLayoutComponent } from './containers';
6-
6+
import { P404Component } from './views/error/404.component';
7+
import { P500Component } from './views/error/500.component';
78
export const routes: Routes = [
89
{
910
path: '',
1011
redirectTo: 'dashboard',
1112
pathMatch: 'full',
1213
},
14+
{
15+
path: '404',
16+
component: P404Component,
17+
data: {
18+
title: 'Page 404'
19+
}
20+
},
21+
{
22+
path: '500',
23+
component: P500Component,
24+
data: {
25+
title: 'Page 500'
26+
}
27+
},
1328
{
1429
path: '',
1530
component: DefaultLayoutComponent,
@@ -20,13 +35,18 @@ export const routes: Routes = [
2035
{
2136
path: 'dashboard',
2237
loadChildren: './views/dashboard/dashboard.module#DashboardModule'
23-
}
38+
},
39+
{
40+
path: 'theme',
41+
loadChildren: './views/theme/theme.module#ThemeModule'
42+
},
2443
]
25-
}
44+
},
45+
{ path: '**', component: P404Component }
2646
];
2747

2848
@NgModule({
29-
imports: [ RouterModule.forRoot(routes) ],
49+
imports: [ RouterModule.forRoot(routes, { anchorScrolling: 'enabled', scrollPositionRestoration: 'enabled'}) ],
3050
exports: [ RouterModule ]
3151
})
3252
export class AppRoutingModule {}

src/app/containers/default-layout/default-layout.component.html

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
<cui-header
2-
[navbarBrandRouterLink]="['/dashboard']"
3-
[fixed]="true"
4-
[navbarBrandFull]="{src: 'assets/img/brand/logo.svg', width: 89, height: 25, alt: 'CoreUI Logo'}"
5-
[navbarBrandMinimized]="{src: 'assets/img/brand/sygnet.svg', width: 30, height: 30, alt: 'CoreUI Logo'}"
6-
[sidebarToggler]="'lg'"
7-
[asideMenuToggler]="'lg'">
1+
<cui-header [fixed]="true">
2+
<cui-toggler class="d-lg-none" cuiSidebarToggle></cui-toggler>
3+
<cui-navbar-brand
4+
[navbarBrandRouterLink]="['/dashboard']"
5+
[navbarBrandFull]="{src: 'assets/img/brand/logo.svg', width: 89, height: 25, alt: 'CoreUI Logo'}"
6+
[navbarBrandMinimized]="{src: 'assets/img/brand/sygnet.svg', width: 30, height: 30, alt: 'CoreUI Logo'}"
7+
></cui-navbar-brand>
8+
<cui-toggler class="d-md-down-none" cuiSidebarToggle="lg"></cui-toggler>
89
<ul class="nav navbar-nav d-md-down-none mr-auto">
910
<li class="nav-item px-3">
1011
<a class="nav-link" href="#">Dashboard</a>
@@ -41,11 +42,13 @@
4142
</div>
4243
</li>
4344
</ul>
45+
<cui-toggler class="d-md-down-none" [cuiAsideMenuToggle]="'lg'"></cui-toggler>
46+
<cui-toggler class="d-lg-none" cuiAsideMenuToggle></cui-toggler>
4447
</cui-header>
4548
<div class="app-body">
46-
<cui-sidebar [fixed]="true" [display]="'lg'">
49+
<cui-sidebar [fixed]="true" [display]="'lg'" [opened]="true">
4750
<cui-sidebar-nav [navItems]="navItems" [perfectScrollbar] [disabled]="sidebarMinimized"></cui-sidebar-nav>
48-
<cui-sidebar-minimizer></cui-sidebar-minimizer>
51+
<cui-sidebar-minimizer cuiSidebarMinimize cuiBrandMinimize></cui-sidebar-minimizer>
4952
</cui-sidebar>
5053
<!-- Main content -->
5154
<main class="main">
@@ -56,10 +59,19 @@
5659
</div><!-- /.container-fluid -->
5760
</main>
5861
<cui-aside [fixed]="true" [display]="false">
59-
62+
<cui-toggler cuiSidebarToggle="lg">
63+
<button class="navbar-toggler" type="button">
64+
<span class="cui-layers align-middle h2"></span>
65+
</button>
66+
</cui-toggler>
67+
<button cuiSidebarMinimize>Sidebar minimizer</button>
68+
<br/>
69+
<button cuiSidebarToggle="lg">Sidebar toggler</button>
70+
<br/>
71+
<button cuiSidebarToggle>Sidebar mobile toggler</button>
6072
</cui-aside>
6173
</div>
6274
<cui-footer>
6375
<span><a href="https://coreui.io/pro/angular/">CoreUI</a> &copy; 2019 creativeLabs.</span>
64-
<span class="ml-auto">Powered by <a href="https://coreui.io/pro/angular">CoreUI Pro for Angular</a></span>
76+
<span class="ml-auto">Powered by <a href="https://coreui.io/pro/angular">CoreUI v3 for Angular</a></span>
6577
</cui-footer>

src/app/containers/default-layout/default-layout.component.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnDestroy, Inject } from '@angular/core';
1+
import { Component, OnDestroy, Inject, OnInit } from '@angular/core';
22
import { DOCUMENT } from '@angular/common';
33
import { navItems } from '../../_nav';
44

@@ -7,11 +7,12 @@ import { navItems } from '../../_nav';
77
selector: 'app-dashboard',
88
templateUrl: './default-layout.component.html'
99
})
10-
export class DefaultLayoutComponent implements OnDestroy {
10+
export class DefaultLayoutComponent implements OnDestroy, OnInit {
1111
public navItems = navItems;
1212
public sidebarMinimized = true;
1313
private changes: MutationObserver;
14-
public element: HTMLElement;
14+
public element: HTMLBodyElement;
15+
1516
constructor(@Inject(DOCUMENT) _document?: any) {
1617

1718
this.changes = new MutationObserver((mutations) => {
@@ -24,6 +25,8 @@ export class DefaultLayoutComponent implements OnDestroy {
2425
});
2526
}
2627

28+
ngOnInit(): void {}
29+
2730
ngOnDestroy(): void {
2831
this.changes.disconnect();
2932
}

src/app/views/dashboard/dashboard-routing.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const routes: Routes = [
1414
];
1515

1616
@NgModule({
17-
imports: [RouterModule.forChild(routes)],
18-
exports: [RouterModule]
17+
imports: [ RouterModule.forChild(routes) ],
18+
exports: [ RouterModule ]
1919
})
2020
export class DashboardRoutingModule {}

0 commit comments

Comments
 (0)