mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-16 15:40:11 +01:00
chore: base layout
This commit is contained in:
parent
1fb884a633
commit
d82d691681
19 changed files with 195 additions and 44 deletions
16
src/app/@core/core.module.ts
Normal file
16
src/app/@core/core.module.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { NgModule, Optional, SkipSelf } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { throwIfAlreadyLoaded } from './module-import-guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule
|
||||
],
|
||||
declarations: []
|
||||
})
|
||||
export class CoreModule {
|
||||
constructor(@Optional() @SkipSelf() parentModule: CoreModule) {
|
||||
throwIfAlreadyLoaded(parentModule, 'CoreModule');
|
||||
}
|
||||
}
|
||||
5
src/app/@core/module-import-guard.ts
Normal file
5
src/app/@core/module-import-guard.ts
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
export function throwIfAlreadyLoaded(parentModule: any, moduleName: string) {
|
||||
if (parentModule) {
|
||||
throw new Error(`${moduleName} has already been loaded. Import Core modules in the AppModule only.`);
|
||||
}
|
||||
}
|
||||
1
src/app/@theme/layouts/index.ts
Normal file
1
src/app/@theme/layouts/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from './one-coll-layout/one-coll.layout';
|
||||
18
src/app/@theme/layouts/one-coll-layout/one-coll.layout.ts
Normal file
18
src/app/@theme/layouts/one-coll-layout/one-coll.layout.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'one-coll-layout',
|
||||
template: `
|
||||
<nga-layout>
|
||||
<nga-layout-header fixed></nga-layout-header>
|
||||
<nga-sidebar fixed></nga-sidebar>
|
||||
<nga-layout-column>
|
||||
<ng-content></ng-content>
|
||||
</nga-layout-column>
|
||||
<nga-layout-footer fixed></nga-layout-footer>
|
||||
</nga-layout>
|
||||
`,
|
||||
})
|
||||
export class RootLayoutComponent {
|
||||
constructor() { }
|
||||
}
|
||||
3
src/app/@theme/styles/default.theme.scss
Normal file
3
src/app/@theme/styles/default.theme.scss
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
@import '~@nga/theme/styles/themes/nga.theme.default';
|
||||
|
||||
@include nga-theme();
|
||||
1
src/app/@theme/styles/styles.scss
Normal file
1
src/app/@theme/styles/styles.scss
Normal file
|
|
@ -0,0 +1 @@
|
|||
@import "default.theme";
|
||||
50
src/app/@theme/theme.module.ts
Normal file
50
src/app/@theme/theme.module.ts
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
|
||||
import {
|
||||
NgaCardModule,
|
||||
NgaLayoutModule,
|
||||
NgaTabsetModule,
|
||||
NgaRouteTabsetModule,
|
||||
NgaSidebarModule,
|
||||
NgaMenuModule
|
||||
} from '@nga/theme';
|
||||
|
||||
import { RootLayoutComponent } from './layouts';
|
||||
|
||||
const BASE_MODULES = [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule
|
||||
];
|
||||
|
||||
const NGA_MODULES = [
|
||||
NgaCardModule,
|
||||
NgaLayoutModule,
|
||||
NgaTabsetModule,
|
||||
NgaRouteTabsetModule,
|
||||
NgaSidebarModule,
|
||||
NgaMenuModule
|
||||
];
|
||||
|
||||
const LAYOUT_COMPONENTS = [
|
||||
RootLayoutComponent
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
...BASE_MODULES,
|
||||
...NGA_MODULES,
|
||||
],
|
||||
exports: [
|
||||
...BASE_MODULES,
|
||||
...NGA_MODULES,
|
||||
...LAYOUT_COMPONENTS
|
||||
],
|
||||
declarations: [
|
||||
...LAYOUT_COMPONENTS
|
||||
]
|
||||
})
|
||||
export class ThemeModule {
|
||||
}
|
||||
20
src/app/app-routing.module.ts
Normal file
20
src/app/app-routing.module.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { ExtraOptions, RouterModule, Routes } from '@angular/router';
|
||||
import { NgModule } from '@angular/core';
|
||||
|
||||
const routes: Routes = [
|
||||
// {path: 'admin'}
|
||||
{path: 'pages', loadChildren: 'app/pages/pages.module#PagesModule'},
|
||||
{path: '', redirectTo: 'pages', pathMatch: 'full'},
|
||||
{path: '**', redirectTo: 'pages'}
|
||||
];
|
||||
|
||||
const config: ExtraOptions = {
|
||||
useHash: true
|
||||
};
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes, config)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AppRoutingModule {
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
<nga-card status="danger">
|
||||
<nga-card-header>
|
||||
<span>Header</span>
|
||||
</nga-card-header>
|
||||
<nga-card-body>
|
||||
<span>Body</span>
|
||||
</nga-card-body>
|
||||
<nga-card-footer>
|
||||
<span>Footer</span>
|
||||
</nga-card-footer>
|
||||
</nga-card>
|
||||
|
|
@ -1,9 +1 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Akveo. All Rights Reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*/
|
||||
|
||||
@import '~@nga/theme/styles/themes/nga.theme.default';
|
||||
|
||||
@include nga-theme();
|
||||
@import "@theme/styles/styles";
|
||||
|
|
|
|||
|
|
@ -6,10 +6,9 @@
|
|||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'nga-app-root',
|
||||
templateUrl: './app.component.html',
|
||||
selector: 'app',
|
||||
template: '<router-outlet></router-outlet>',
|
||||
styleUrls: ['./app.component.scss'],
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'app works!';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,37 +5,31 @@
|
|||
*/
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { HttpModule } from '@angular/http';
|
||||
|
||||
import {
|
||||
NgaThemeModule,
|
||||
NgaCardModule,
|
||||
NgaLayoutModule,
|
||||
NgaMenuModule,
|
||||
NgaRouteTabsetModule,
|
||||
NgaSidebarModule,
|
||||
NgaTabsetModule,
|
||||
NgaThemeModule
|
||||
} from '@nga/theme';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { CoreModule } from './@core/core.module';
|
||||
import { PagesModule } from './pages/pages.module';
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
],
|
||||
declarations: [AppComponent],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
FormsModule,
|
||||
HttpModule,
|
||||
NgaThemeModule,
|
||||
NgaCardModule,
|
||||
NgaLayoutModule,
|
||||
NgaMenuModule,
|
||||
NgaRouteTabsetModule,
|
||||
NgaSidebarModule,
|
||||
NgaTabsetModule,
|
||||
NgaThemeModule.forRoot(),
|
||||
NgaSidebarModule.forRoot(),
|
||||
AppRoutingModule,
|
||||
CoreModule,
|
||||
PagesModule
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent],
|
||||
})
|
||||
export class AppModule { }
|
||||
export class AppModule {
|
||||
}
|
||||
|
|
|
|||
0
src/app/pages/dashboard/dashboard.component.html
Normal file
0
src/app/pages/dashboard/dashboard.component.html
Normal file
0
src/app/pages/dashboard/dashboard.component.scss
Normal file
0
src/app/pages/dashboard/dashboard.component.scss
Normal file
9
src/app/pages/dashboard/dashboard.component.ts
Normal file
9
src/app/pages/dashboard/dashboard.component.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dashboard',
|
||||
templateUrl: './dashboard.component.html',
|
||||
styleUrls: ['./dashboard.component.scss']
|
||||
})
|
||||
export class DashboardComponent {
|
||||
}
|
||||
23
src/app/pages/pages-routing.module.ts
Normal file
23
src/app/pages/pages-routing.module.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { PagesComponent } from './pages.component';
|
||||
import { DashboardComponent } from './dashboard/dashboard.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: PagesComponent,
|
||||
children: [
|
||||
{path: '', redirectTo: 'dashboard', pathMatch: 'full'},
|
||||
{path: 'dashboard', component: DashboardComponent}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class PagesRoutingModule {
|
||||
}
|
||||
12
src/app/pages/pages.component.ts
Normal file
12
src/app/pages/pages.component.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'pages',
|
||||
template: `
|
||||
<one-coll-layout>
|
||||
<router-outlet></router-outlet>
|
||||
</one-coll-layout>
|
||||
`
|
||||
})
|
||||
export class PagesComponent {
|
||||
}
|
||||
19
src/app/pages/pages.module.ts
Normal file
19
src/app/pages/pages.module.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { PagesComponent } from './pages.component';
|
||||
import { DashboardComponent } from './dashboard/dashboard.component';
|
||||
import { PagesRoutingModule } from './pages-routing.module';
|
||||
import { ThemeModule } from '../@theme/theme.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
PagesRoutingModule,
|
||||
ThemeModule
|
||||
],
|
||||
declarations: [
|
||||
PagesComponent,
|
||||
DashboardComponent
|
||||
]
|
||||
})
|
||||
export class PagesModule {
|
||||
}
|
||||
|
|
@ -2,13 +2,13 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>@nga/framework</title>
|
||||
<title>NgX Admin Demo</title>
|
||||
<base href="/">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
<nga-app-root>Loading...</nga-app-root>
|
||||
<app>Loading...</app>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue