Skip to content

Commit

Permalink
feat(stark-ui): example Viewer + basic showcase layout
Browse files Browse the repository at this point in the history
ISSUES CLOSED: #458, #459
  • Loading branch information
catlabs committed Jul 4, 2018
1 parent d2c36cd commit ff675c8
Show file tree
Hide file tree
Showing 34 changed files with 567 additions and 65 deletions.
26 changes: 3 additions & 23 deletions packages/stark-ui/assets/themes/_app-header-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.stark-app-header {
background: #123b71 url(/assets/images/app-header.png) top right no-repeat;
color: #fff;
& .md-button.md-icon-button {
& .mat-icon-button {
min-width: 0;
min-height: 0;
line-height: 48px;
Expand All @@ -21,7 +21,6 @@
.stark-header-extra {
position: absolute;
display: flex;
top: 0;
right: 0;
}
.stark-header-mobile,
Expand Down Expand Up @@ -97,18 +96,6 @@
line-height: 48px;
}

/* dense mode */
.dense-mode {
& .stark-app-header .md-button.md-icon-button {
height: 40px;
line-height: 0;
& svg {
height: 20px;
width: 20px;
}
}
}

.stark-page-header {
position: relative;
}
Expand Down Expand Up @@ -144,15 +131,8 @@
.stark-app-bar {
display: flex;
line-height: 48px;
& .md-button.md-icon-button {
margin: 0;
padding: 8px;
color: #fff;
}
& > .md-button.md-icon-button {
margin-top: 4px;
}
& .stark-app-logout .md-button {
padding-top: 4px;
& .stark-app-logout button {
background-color: $message-alert;
color: #fff;
&:hover {
Expand Down
13 changes: 12 additions & 1 deletion showcase/karma.conf.ci.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
/**
* Load karma config from Stark
*/
module.exports = require("./node_modules/@nationalbankbelgium/stark-testing/karma.conf.ci.js");
const defaultKarmaCIConfig = require("./node_modules/@nationalbankbelgium/stark-testing/karma.conf.ci.js").rawKarmaConfig;
const karmaTypescriptExclusions = require("./karma.conf").karmaTypescriptExclusions;

// start customizing the KarmaCI configuration from stark-testing
const starkShowcaseSpecificConfiguration = Object.assign({}, defaultKarmaCIConfig, {
exclude: [...defaultKarmaCIConfig.exclude, ...karmaTypescriptExclusions]
});

// export the configuration function that karma expects and simply return the stark configuration
module.exports = config => {
return config.set(starkShowcaseSpecificConfiguration);
};
24 changes: 23 additions & 1 deletion showcase/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
/**
* Load karma config from Stark
*/
module.exports = require("./node_modules/@nationalbankbelgium/stark-testing/karma.conf.js");
const helpers = require("./node_modules/@nationalbankbelgium/stark-testing/helpers");

/**
* Load karma config from Stark
*/
const defaultKarmaConfig = require("./node_modules/@nationalbankbelgium/stark-testing/karma.conf.js").rawKarmaConfig;

// entry files of the "@nationalbankbelgium/stark-ui" module imported in mock files
const karmaTypescriptExclusions = [...defaultKarmaConfig.exclude, "src/assets/examples/*"];

// start customizing the KarmaCI configuration from stark-testing
const starkShowcaseSpecificConfiguration = Object.assign({}, defaultKarmaConfig, {
// list of files to exclude
exclude: karmaTypescriptExclusions
});

// export the configuration function that karma expects and simply return the stark configuration
module.exports = {
default: function(config) {
return config.set(starkShowcaseSpecificConfiguration);
},
karmaTypescriptExclusions: karmaTypescriptExclusions
};
10 changes: 6 additions & 4 deletions showcase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,15 @@
"@angular/platform-browser-dynamic": "6.0.4",
"@angular/platform-server": "6.0.4",
"@angular/router": "6.0.4",
"@nationalbankbelgium/stark-core": "file:../dist/packages-dist/stark-core/nationalbankbelgium-stark-core-10.0.0-alpha.3-8c85d07.tgz",
"@nationalbankbelgium/stark-ui": "file:../dist/packages-dist/stark-ui/nationalbankbelgium-stark-ui-10.0.0-alpha.3-8c85d07.tgz",
"@nationalbankbelgium/stark-core": "file:../dist/packages-dist/stark-core/nationalbankbelgium-stark-core-10.0.0-alpha.3-6796ad0.tgz",
"@nationalbankbelgium/stark-ui": "file:../dist/packages-dist/stark-ui/nationalbankbelgium-stark-ui-10.0.0-alpha.3-6796ad0.tgz",
"@uirouter/visualizer": "6.0.0",
"angular-highlight-js": "^2.0.1",
"basscss": "^8.0.2",
"core-js": "2.5.7",
"eligrey-classlist-js-polyfill": "1.2.20180112",
"event-source-polyfill": "0.0.12",
"highlight.js": "^9.12.0",
"http-server": "0.11.1",
"ngrx-store-freeze": "0.2.4",
"ngrx-store-logger": "0.2.2",
Expand All @@ -139,8 +141,8 @@
"zone.js": "0.8.26"
},
"devDependencies": {
"@nationalbankbelgium/stark-build": "file:../dist/packages-dist/stark-build/nationalbankbelgium-stark-build-10.0.0-alpha.3-8c85d07.tgz",
"@nationalbankbelgium/stark-testing": "file:../dist/packages-dist/stark-testing/nationalbankbelgium-stark-testing-10.0.0-alpha.3-8c85d07.tgz",
"@nationalbankbelgium/stark-build": "file:../dist/packages-dist/stark-build/nationalbankbelgium-stark-build-10.0.0-alpha.3-6796ad0.tgz",
"@nationalbankbelgium/stark-testing": "file:../dist/packages-dist/stark-testing/nationalbankbelgium-stark-testing-10.0.0-alpha.3-6796ad0.tgz",
"@types/core-js": "2.5.0",
"@types/hammerjs": "2.0.35",
"@types/node": "8.10.15",
Expand Down
5 changes: 0 additions & 5 deletions showcase/src/app/app.component.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
html,
body {
height: 100%;
font-family: Arial, Helvetica, sans-serif;
}

a.active {
background-color: #888;
}
37 changes: 33 additions & 4 deletions showcase/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
<stark-app-logo></stark-app-logo>
<header class="stark-header aah-stark">
<div class="stark-container">
<div class="stark-app-bar">
<button mat-icon-button><mat-icon svgIcon="home"></mat-icon></button>
<button (click)="sidenav.toggle()" mat-icon-button><mat-icon svgIcon="menu"></mat-icon></button>
<button mat-icon-button><mat-icon svgIcon="arrow-left"></mat-icon></button>

<main>
<ui-view></ui-view>
</main>
<stark-app-logo></stark-app-logo>

<div class="stark-header-extra">
<button mat-mini-fab color="warn"><mat-icon svgIcon="power"></mat-icon></button>
</div>
</div>
</div>
</header>

<mat-sidenav-container class="stark-main-content">
<mat-sidenav #sidenav mode="side" [fixedInViewport]="true" [fixedTopGap]="128" [fixedBottomGap]="0" closed>
<mat-nav-list class="nav-main">
<a mat-list-item uiSref="home" uiSrefActive="active">
<span matLine>Home</span>
</a>
<a mat-list-item uiSref="demo-example-viewer" uiSrefActive="active">
<span matLine>Example Viewer</span>
</a>
</mat-nav-list>
</mat-sidenav>
<mat-sidenav-content class="px4 py2">
<main>
<ui-view></ui-view>
</main>

</mat-sidenav-content>
</mat-sidenav-container>
19 changes: 18 additions & 1 deletion showcase/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ import { storeFreeze } from "ngrx-store-freeze";
import { storeLogger } from "ngrx-store-logger";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { MatIconRegistry } from "@angular/material";
import { MatButtonModule } from "@angular/material/button";
import { MatCardModule } from "@angular/material/card";
import { MatIconModule } from "@angular/material/icon";
import { MatSortModule } from "@angular/material/sort";
import { MatTableModule } from "@angular/material/table";
import { MatListModule } from "@angular/material/list";
import { MatSidenavModule } from "@angular/material/sidenav";
import { SharedModule } from "./shared/shared.module";

import {
STARK_APP_CONFIG,
Expand Down Expand Up @@ -53,6 +61,7 @@ import { NoContentComponent } from "./no-content";
import "../styles/styles.pcss";
// load SASS styles
import "../styles/styles.scss";
import { DemoComponent } from "./demo/demo.component";
/* tslint:enable */

// Application wide providers
Expand Down Expand Up @@ -111,14 +120,21 @@ export const metaReducers: MetaReducer<State>[] = ENV !== "production" ? [logger
*/
@NgModule({
bootstrap: [AppComponent],
declarations: [AppComponent, HomeComponent, NoContentComponent],
declarations: [AppComponent, HomeComponent, NoContentComponent, DemoComponent],
/**
* Import Angular's modules.
*/
imports: [
BrowserModule,
BrowserAnimationsModule,
FormsModule,
MatButtonModule,
MatCardModule,
MatIconModule,
MatSortModule,
MatTableModule,
MatListModule,
MatSidenavModule,
StoreModule.forRoot(reducers, {
metaReducers
}),
Expand All @@ -131,6 +147,7 @@ export const metaReducers: MetaReducer<State>[] = ENV !== "production" ? [logger
TranslateModule.forRoot(),
NgIdleModule.forRoot(),
NgIdleKeepaliveModule.forRoot(), // FIXME: disabled in stark-app-config.json for now until json-server is integrated
SharedModule,
StarkHttpModule.forRoot(),
StarkLoggingModule.forRoot(),
StarkSessionModule.forRoot(),
Expand Down
5 changes: 3 additions & 2 deletions showcase/src/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { DemoComponent } from "./demo";
import { HomeComponent } from "./home";
import { NoContentComponent } from "./no-content";
import { Ng2StateDeclaration } from "@uirouter/angular";

export const APP_STATES: Ng2StateDeclaration[] = [
{ name: "index", url: "/", component: HomeComponent },
{ name: "home", url: "/home", component: HomeComponent },
{ name: "home", url: "/", component: HomeComponent },
{ name: "demo-example-viewer", url: "/demo-example-viewer", component: DemoComponent },
{ name: "otherwise", url: "/otherwise", component: NoContentComponent }
];
11 changes: 11 additions & 0 deletions showcase/src/app/demo/demo.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<example-viewer filesPath="test" title="Example Viewer">
<h3>Raised Buttons</h3>
<div class="button-row">
<button mat-raised-button>Basic</button>
<button mat-raised-button color="primary">Primary</button>
<button mat-raised-button color="accent">Accent</button>
<button mat-raised-button color="warn">Warn</button>
<button mat-raised-button disabled>Disabled</button>
<a mat-raised-button routerLink=".">Link</a>
</div>
</example-viewer>
Empty file.
26 changes: 26 additions & 0 deletions showcase/src/app/demo/demo.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { HttpClientModule } from "@angular/common/http";
import { async, ComponentFixture, TestBed } from "@angular/core/testing";
import { DemoComponent } from "./demo.component";
import { SharedModule } from "../shared/shared.module";

describe("DemoComponent", () => {
let component: DemoComponent;
let fixture: ComponentFixture<DemoComponent>;

beforeEach(async(() => {
return TestBed.configureTestingModule({
declarations: [DemoComponent],
imports: [HttpClientModule, SharedModule]
}).compileComponents();
}));

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

it("should create", () => {
expect(component).toBeTruthy();
});
});
8 changes: 8 additions & 0 deletions showcase/src/app/demo/demo.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Component } from "@angular/core";

@Component({
selector: "showcase-demo",
templateUrl: "./demo.component.html",
styleUrls: ["./demo.component.scss"]
})
export class DemoComponent {}
1 change: 1 addition & 0 deletions showcase/src/app/demo/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./demo.component";
25 changes: 18 additions & 7 deletions showcase/src/app/home/home.component.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
<div>
<h1 translate>SHOWCASE.HOME.TITLE</h1>

<hr>

Coming soon!

</div>
<div class="mb3">
<mat-card>
<mat-card-header>
<mat-card-title>
<h1>Angular Material components</h1>
</mat-card-title>
</mat-card-header>
<mat-card-content>
<div class="mb2">
<button mat-raised-button>Basic</button>
<button mat-raised-button color="primary">Primary</button>
<button mat-raised-button color="accent">Accent</button>
<button mat-raised-button color="warn">Warn</button>
<button mat-raised-button disabled>Disabled</button>
</div>
</mat-card-content>
</mat-card>
</div>
9 changes: 0 additions & 9 deletions showcase/src/app/home/home.component.pcss

This file was deleted.

Empty file.
2 changes: 1 addition & 1 deletion showcase/src/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { AppState } from "../app.service";
@Component({
selector: "home", // <home></home>
providers: [],
styleUrls: ["./home.component.pcss"],
styleUrls: ["./home.component.scss"],
templateUrl: "./home.component.html"
})
export class HomeComponent implements OnInit {
Expand Down
Loading

0 comments on commit ff675c8

Please sign in to comment.