mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-09-22 05:50:48 +02:00
refator(@theme): add menu transclusion in one-coll layout
This commit is contained in:
parent
d82d691681
commit
ed658566b3
8 changed files with 61 additions and 12 deletions
14
src/app/@theme/layouts/one-coll-layout/one-coll.layout.scss
Normal file
14
src/app/@theme/layouts/one-coll-layout/one-coll.layout.scss
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
:host {
|
||||||
|
& > nga-layout-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
& > nga-sidebar {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
& > nga-layout-footer {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,15 +1,27 @@
|
||||||
|
/*
|
||||||
|
* TODO
|
||||||
|
* I think we need to store our header, footer,
|
||||||
|
* sedibars and etc. separetly, each in it's own
|
||||||
|
* component.
|
||||||
|
*
|
||||||
|
* And of course we need to make this layout part
|
||||||
|
* reusable.
|
||||||
|
* */
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'one-coll-layout',
|
selector: 'one-coll-layout',
|
||||||
|
styleUrls: ['./one-coll.layout.scss'],
|
||||||
template: `
|
template: `
|
||||||
<nga-layout>
|
<nga-layout>
|
||||||
<nga-layout-header fixed></nga-layout-header>
|
<nga-layout-header fixed></nga-layout-header>
|
||||||
<nga-sidebar fixed></nga-sidebar>
|
<nga-sidebar fixed>
|
||||||
|
<ng-content select="nga-menu"></ng-content>
|
||||||
|
</nga-sidebar>
|
||||||
<nga-layout-column>
|
<nga-layout-column>
|
||||||
<ng-content></ng-content>
|
<ng-content select="router-outlet"></ng-content>
|
||||||
</nga-layout-column>
|
</nga-layout-column>
|
||||||
<nga-layout-footer fixed></nga-layout-footer>
|
<nga-layout-footer></nga-layout-footer>
|
||||||
</nga-layout>
|
</nga-layout>
|
||||||
`,
|
`,
|
||||||
})
|
})
|
||||||
|
|
|
@ -8,7 +8,8 @@ import {
|
||||||
NgaTabsetModule,
|
NgaTabsetModule,
|
||||||
NgaRouteTabsetModule,
|
NgaRouteTabsetModule,
|
||||||
NgaSidebarModule,
|
NgaSidebarModule,
|
||||||
NgaMenuModule
|
NgaMenuModule,
|
||||||
|
NgaUserModule
|
||||||
} from '@nga/theme';
|
} from '@nga/theme';
|
||||||
|
|
||||||
import { RootLayoutComponent } from './layouts';
|
import { RootLayoutComponent } from './layouts';
|
||||||
|
@ -25,7 +26,8 @@ const NGA_MODULES = [
|
||||||
NgaTabsetModule,
|
NgaTabsetModule,
|
||||||
NgaRouteTabsetModule,
|
NgaRouteTabsetModule,
|
||||||
NgaSidebarModule,
|
NgaSidebarModule,
|
||||||
NgaMenuModule
|
NgaMenuModule,
|
||||||
|
NgaUserModule
|
||||||
];
|
];
|
||||||
|
|
||||||
const LAYOUT_COMPONENTS = [
|
const LAYOUT_COMPONENTS = [
|
||||||
|
|
|
@ -7,11 +7,7 @@ import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { HttpModule } from '@angular/http';
|
import { HttpModule } from '@angular/http';
|
||||||
|
|
||||||
import {
|
import { NgaThemeModule } from '@nga/theme';
|
||||||
NgaMenuModule,
|
|
||||||
NgaSidebarModule,
|
|
||||||
NgaThemeModule
|
|
||||||
} from '@nga/theme';
|
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { CoreModule } from './@core/core.module';
|
import { CoreModule } from './@core/core.module';
|
||||||
|
@ -24,7 +20,6 @@ import { AppRoutingModule } from './app-routing.module';
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
HttpModule,
|
HttpModule,
|
||||||
NgaThemeModule.forRoot(),
|
NgaThemeModule.forRoot(),
|
||||||
NgaSidebarModule.forRoot(),
|
|
||||||
AppRoutingModule,
|
AppRoutingModule,
|
||||||
CoreModule,
|
CoreModule,
|
||||||
PagesModule
|
PagesModule
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dashboard',
|
selector: 'dashboard',
|
||||||
templateUrl: './dashboard.component.html',
|
templateUrl: './dashboard.component.html',
|
||||||
styleUrls: ['./dashboard.component.scss']
|
styleUrls: ['./dashboard.component.scss']
|
||||||
})
|
})
|
||||||
|
|
12
src/app/pages/pages-menu.ts
Normal file
12
src/app/pages/pages-menu.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import { NgaMenuItem } from '@nga/theme/components/menu/menu.options';
|
||||||
|
|
||||||
|
import { List } from 'immutable';
|
||||||
|
|
||||||
|
export const menuItems: List<NgaMenuItem> = List([
|
||||||
|
{
|
||||||
|
title: 'lorem ipsum 1'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'lorem ipsum 2'
|
||||||
|
}
|
||||||
|
]);
|
|
@ -1,12 +1,19 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
import { List } from 'immutable';
|
||||||
|
|
||||||
|
import { menuItems } from './pages-menu';
|
||||||
|
import { NgaMenuItem } from '@nga/theme/components/menu/menu.options';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'pages',
|
selector: 'pages',
|
||||||
template: `
|
template: `
|
||||||
<one-coll-layout>
|
<one-coll-layout>
|
||||||
|
<nga-menu [menuItems]="menuItems"></nga-menu>
|
||||||
<router-outlet></router-outlet>
|
<router-outlet></router-outlet>
|
||||||
</one-coll-layout>
|
</one-coll-layout>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class PagesComponent {
|
export class PagesComponent {
|
||||||
|
menuItems: List<NgaMenuItem> = menuItems;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
|
import {
|
||||||
|
NgaSidebarModule,
|
||||||
|
NgaMenuModule
|
||||||
|
} from '@nga/theme';
|
||||||
|
|
||||||
import { PagesComponent } from './pages.component';
|
import { PagesComponent } from './pages.component';
|
||||||
import { DashboardComponent } from './dashboard/dashboard.component';
|
import { DashboardComponent } from './dashboard/dashboard.component';
|
||||||
import { PagesRoutingModule } from './pages-routing.module';
|
import { PagesRoutingModule } from './pages-routing.module';
|
||||||
|
@ -7,6 +12,8 @@ import { ThemeModule } from '../@theme/theme.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
NgaSidebarModule.forRoot(),
|
||||||
|
NgaMenuModule.forRoot(),
|
||||||
PagesRoutingModule,
|
PagesRoutingModule,
|
||||||
ThemeModule
|
ThemeModule
|
||||||
],
|
],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue