Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 479b608

Browse files
authored
feat(demos): Improvements and move to CLI (#1588)
- Moved demo app to Angular CLI. - Use `highlight.js` for code snippets - New and improved examples related issue #1158
1 parent f2dba6c commit 479b608

File tree

120 files changed

+7018
-1229
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+7018
-1229
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
# dependencies
99
/node_modules
10+
/demos/node_modules
11+
/demos/dist
1012

1113
# IDEs and editors
1214
/.idea

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Developed using Google Material Components [foundations and adapters](https://gi
5050
| snackbar | Available | [View](https://trimox.github.io/angular-mdc-web/#/snackbar-demo) |
5151
| switch | Available | [View](https://trimox.github.io/angular-mdc-web/#/switch-demo) |
5252
| tabs | Available | [View](https://trimox.github.io/angular-mdc-web/#/tabs-demo) |
53-
| textfield | Available | [View](https://trimox.github.io/angular-mdc-web/#/textfield-demo) |
53+
| text-field | Available | [View](https://trimox.github.io/angular-mdc-web/#/text-field-demo) |
5454
| top-app-bar | Available | [View](https://trimox.github.io/angular-mdc-web/#/top-app-bar-demo) |
5555
| typography | Available | [View](https://trimox.github.io/angular-mdc-web/#/typography-demo) |
5656

demos/angular.json

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"angular-mdc-demos": {
7+
"root": "",
8+
"sourceRoot": "src",
9+
"projectType": "application",
10+
"prefix": "app",
11+
"schematics": {
12+
"@schematics/angular:component": {
13+
"styleext": "scss"
14+
}
15+
},
16+
"architect": {
17+
"build": {
18+
"builder": "@angular-devkit/build-angular:browser",
19+
"options": {
20+
"outputPath": "dist/angular-mdc-demos",
21+
"index": "src/index.html",
22+
"main": "src/main.ts",
23+
"polyfills": "src/polyfills.ts",
24+
"tsConfig": "src/tsconfig.app.json",
25+
"assets": [
26+
"src/favicon.ico",
27+
"src/assets"
28+
],
29+
"styles": [
30+
"src/styles.scss"
31+
],
32+
"scripts": []
33+
},
34+
"configurations": {
35+
"production": {
36+
"fileReplacements": [
37+
{
38+
"replace": "src/environments/environment.ts",
39+
"with": "src/environments/environment.prod.ts"
40+
}
41+
],
42+
"optimization": true,
43+
"outputHashing": "all",
44+
"sourceMap": false,
45+
"extractCss": true,
46+
"namedChunks": false,
47+
"aot": true,
48+
"extractLicenses": true,
49+
"vendorChunk": false,
50+
"buildOptimizer": true,
51+
"budgets": [
52+
{
53+
"type": "initial",
54+
"maximumWarning": "2mb",
55+
"maximumError": "5mb"
56+
}
57+
]
58+
}
59+
}
60+
},
61+
"serve": {
62+
"builder": "@angular-devkit/build-angular:dev-server",
63+
"options": {
64+
"browserTarget": "angular-mdc-demos:build"
65+
},
66+
"configurations": {
67+
"production": {
68+
"browserTarget": "angular-mdc-demos:build:production"
69+
}
70+
}
71+
},
72+
"extract-i18n": {
73+
"builder": "@angular-devkit/build-angular:extract-i18n",
74+
"options": {
75+
"browserTarget": "angular-mdc-demos:build"
76+
}
77+
},
78+
"lint": {
79+
"builder": "@angular-devkit/build-angular:tslint",
80+
"options": {
81+
"tsConfig": [
82+
"src/tsconfig.app.json"
83+
],
84+
"exclude": [
85+
"**/node_modules/**"
86+
]
87+
}
88+
}
89+
}
90+
}
91+
},
92+
"defaultProject": "angular-mdc-demos"
93+
}

demos/getting-started/getting-started.html

Lines changed: 0 additions & 65 deletions
This file was deleted.

demos/main.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

demos/package.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "angular-mdc-demos",
3+
"version": "0.0.0",
4+
"scripts": {
5+
"ng": "ng",
6+
"start": "ng serve",
7+
"build": "ng build",
8+
"build:aot": "ng build --prod --aot",
9+
"lint": "ng lint"
10+
},
11+
"private": true,
12+
"dependencies": {
13+
"@angular/common": "~7.1.1",
14+
"@angular/compiler": "~7.1.1",
15+
"@angular/core": "~7.1.1",
16+
"@angular/forms": "~7.1.1",
17+
"@angular/platform-browser": "~7.1.1",
18+
"@angular/platform-browser-dynamic": "~7.1.1",
19+
"@angular/router": "~7.1.1",
20+
"core-js": "^2.6.0",
21+
"rxjs": "~6.3.3",
22+
"tslib": "^1.9.3",
23+
"zone.js": "~0.8.26"
24+
},
25+
"devDependencies": {
26+
"@angular-devkit/build-angular": "~0.11.2",
27+
"@angular/cli": "~7.1.1",
28+
"@angular/compiler-cli": "~7.1.1",
29+
"@types/node": "^10.12.12",
30+
"highlight.js": "^9.13.1",
31+
"ngx-highlightjs": "^3.0.0",
32+
"ts-node": "~7.0.1",
33+
"tslint": "~5.11.0",
34+
"typescript": "~3.1.6"
35+
}
36+
}

demos/polyfills.ts

Lines changed: 0 additions & 34 deletions
This file was deleted.

demos/app-layout.html renamed to demos/src/app/app-layout.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<button mdcIconButton mdcTopAppBarNavIcon (click)="appdrawer.open = !appdrawer.open" icon="menu"></button>
55
</mdc-top-app-bar-section>
66
<mdc-top-app-bar-section align="end">
7+
<span>v0.42.0</span>
78
<a mdcTopAppBarActionItem href="https://github.com/trimox/angular-mdc-web" alt="GitHub" target="_blank" rel="noopener noreferrer">
89
<mdc-icon>
910
<img src="https://trimox.github.io/angular-mdc-web/assets/github-circle-white-transparent.svg" height="24" />

demos/app-layout.ts renamed to demos/src/app/app-layout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class AppLayout implements OnInit, OnDestroy {
4646
{ name: 'Snackbar', route: 'snackbar-demo' },
4747
{ name: 'Switch', route: 'switch-demo' },
4848
{ name: 'Tabs', route: 'tabs-demo' },
49-
{ name: 'Text Field', route: 'textfield-demo' },
49+
{ name: 'Text Field', route: 'text-field-demo' },
5050
{ name: 'Top App Bar', route: 'top-app-bar-demo' },
5151
{ name: 'Typography', route: 'typography-demo' }
5252
];

demos/routes.ts renamed to demos/src/app/app-routing.module.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Routes } from '@angular/router';
1+
import { NgModule } from '@angular/core';
2+
import { Routes, RouterModule } from '@angular/router';
23

34
import { ButtonDemo } from './components/button-demo/button-demo';
45
import { CardDemo } from './components/card-demo/card-demo';
@@ -25,11 +26,11 @@ import { SliderDemo } from './components/slider-demo/slider-demo';
2526
import { SnackbarDemo } from './components/snackbar-demo/snackbar-demo';
2627
import { SwitchDemo } from './components/switch-demo/switch-demo';
2728
import { TabsDemo } from './components/tabs-demo/tabs-demo';
28-
import { TextFieldDemo } from './components/textfield-demo/textfield-demo';
29+
import { TextFieldDemo } from './components/text-field-demo/text-field-demo';
2930
import { TopAppBarDemo } from './components/top-app-bar-demo/top-app-bar-demo';
3031
import { TypographyDemo } from './components/typography-demo/typography-demo';
3132

32-
export const DEMO_ROUTES = [
33+
export const DEMO_DECLARATIONS = [
3334
TopAppBarDemo,
3435
ButtonDemo,
3536
CardDemo,
@@ -61,7 +62,7 @@ export const DEMO_ROUTES = [
6162
TypographyDemo
6263
];
6364

64-
export const APP_ROUTES: Routes = [
65+
const routes: Routes = [
6566
{ path: 'button-demo', component: ButtonDemo },
6667
{ path: 'card-demo', component: CardDemo },
6768
{ path: 'checkbox-demo', component: CheckboxDemo },
@@ -87,8 +88,17 @@ export const APP_ROUTES: Routes = [
8788
{ path: 'snackbar-demo', component: SnackbarDemo },
8889
{ path: 'switch-demo', component: SwitchDemo },
8990
{ path: 'tabs-demo', component: TabsDemo },
90-
{ path: 'textfield-demo', component: TextFieldDemo },
91+
{ path: 'text-field-demo', component: TextFieldDemo },
9192
{ path: 'top-app-bar-demo', component: TopAppBarDemo },
9293
{ path: 'typography-demo', component: TypographyDemo },
9394
{ path: '**', redirectTo: 'home' }
9495
];
96+
97+
@NgModule({
98+
imports: [RouterModule.forRoot(routes, {
99+
useHash: true,
100+
scrollPositionRestoration: 'enabled'
101+
})],
102+
exports: [RouterModule]
103+
})
104+
export class AppRoutingModule { }

0 commit comments

Comments
 (0)