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

Commit 2437511

Browse files
authored
feat(demo): Demo App Improvements (#252)
* Improved navigation * `Drawer` using an experimental `fixed` property * Corrected a few misspelled properties and examples * Add `mdc-surface` documentation * Add `mdc-ripple` documentation * Add documentation for `mdc-fab` absolute positioning * Update getting started guides to show required `MdcCoreModule` import * Update `mdc-list` examples to use `mdc-icon` * Add `mdc-list-group` code example * Add `border` list property documentation and examples * Added `getting-started` guide to documentation site Closes #254
1 parent 6e9c80b commit 2437511

Some content is hidden

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

58 files changed

+613
-379
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Check out our [Getting Started guide](https://github.com/trimox/angular-mdc-web/
3333
Using Angular CLI? Try our [Angular CLI - step by step guide](https://github.com/trimox/angular-mdc-web/blob/master/docs/guide-angular-cli.md).
3434

3535
## Material Design Components
36-
Adapters for `material-components-web` v0.21.1
36+
Using `material-components-web v0.21.1`
3737

3838
| Component | Status | Demo |
3939
| ---------- | ------- | :------: |

docs/getting-started.md

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
- [Step 3 - Import Theme](#step3)
66
- [Step 4 - Include Material Design Icons](#step4)
77
- [Step 5 - Include Roboto Font](#step5)
8-
- [Appendix - Configuring SystemJS](#config-systemjs)
98

109
## Using Angular CLI?
1110
If you intend to use Angular CLI, please reference [Angular CLI - Getting Started guide](https://github.com/trimox/angular-mdc-web/blob/master/docs/guide-angular-cli.md).
@@ -31,17 +30,15 @@ export class ExampleModule { }
3130
### Or individual components
3231
```ts
3332
import {
34-
MdcTypographyModule,
35-
MdcMaterialIconModule,
33+
MdcCoreModule, // required
3634
MdcFabModule,
3735
MdcMenuModule
3836
} from '@angular-mdc/web';
3937

4038
@NgModule({
4139
...
4240
imports: [
43-
MdcTypographyModule, // required
44-
  MdcMaterialIconModule, // required for material icons
41+
MdcCoreModule, // required
4542
MdcFabModule,
4643
MdcMenuModule,
4744
...
@@ -74,18 +71,4 @@ Add the Roboto font with 300, 400 and 500 weights to your `index.html`.
7471
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
7572
```
7673

77-
## <a name="config-systemjs"></a> Appendix: Configuring SystemJS
78-
79-
If your project is using SystemJS for module loading, you will need to add `@angular-mdc/web`
80-
to the SystemJS configuration:
81-
82-
```js
83-
System.config({
84-
// existing configuration options
85-
map: {
86-
// ...
87-
'@angular-mdc/web': 'npm:@angular-mdc/web/bundles/material.umd.js',
88-
// ...
89-
}
90-
});
91-
```
74+
### All done!

src/demo-app/app.component.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,11 @@ import { Router, NavigationEnd } from '@angular/router';
33

44
@Component({
55
selector: 'app-root',
6-
template:
7-
`
8-
<div mdc-typography>
9-
<navbar></navbar>
10-
<router-outlet></router-outlet>
11-
</div>
12-
`
6+
template: '<app-toolbar></app-toolbar>'
137
})
148
export class AppComponent implements OnInit {
159
constructor(private _router: Router) { }
10+
1611
ngOnInit() {
1712
this._router.events.subscribe(event => {
1813
if (this._router.url !== '/' && !this._router.url.includes('/tab-demo')) {

src/demo-app/app.module.ts

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,35 @@ import { FlexLayoutModule } from '@angular/flex-layout';
99
import { DemoMaterialModule } from './demo-material.module';
1010

1111
import { AppComponent } from './app.component';
12-
import { ButtonDemo } from './components/button-demo/button-demo';
12+
import { ButtonDemo } from './components/buttons/button-demo/button-demo';
1313
import { CardDemo } from './components/card-demo/card-demo';
14-
import { CheckboxDemo } from './components/checkbox-demo/checkbox-demo';
14+
import { CheckboxDemo } from './components/inputs-controls/checkbox-demo/checkbox-demo';
1515
import { DialogDemo } from './components/dialog-demo/dialog-demo';
1616
import { DrawerDemo } from './components/drawer-demo/drawer-demo';
17-
import { FabDemo } from './components/fab-demo/fab-demo';
17+
import { FabDemo } from './components/buttons/fab-demo/fab-demo';
1818
import { ElevationDemo } from './components/core/elevation-demo/elevation-demo';
19-
import { IconToggleDemo } from './components/icon-toggle-demo/icon-toggle-demo';
19+
import { IconToggleDemo } from './components/buttons/icon-toggle-demo/icon-toggle-demo';
2020
import { LinearProgressDemo } from './components/linear-progress-demo/linear-progress-demo';
2121
import { ListDemo } from './components/list-demo/list-demo';
2222
import { MenuDemo } from './components/menu-demo/menu-demo';
23-
import { RadioDemo } from './components/radio-demo/radio-demo';
24-
import { SliderDemo } from './components/slider-demo/slider-demo';
23+
import { RadioDemo } from './components/inputs-controls/radio-demo/radio-demo';
24+
import { SliderDemo } from './components/inputs-controls/slider-demo/slider-demo';
2525
import { IconDemo } from './components/icon-demo/icon-demo';
2626
import { SnackbarDemo } from './components/snackbar-demo/snackbar-demo';
27-
import { SwitchDemo } from './components/switch-demo/switch-demo';
28-
import { TextfieldDemo } from './components/textfield-demo/textfield-demo';
27+
import { SwitchDemo } from './components/inputs-controls/switch-demo/switch-demo';
28+
import { TextfieldDemo } from './components/inputs-controls/textfield-demo/textfield-demo';
2929
import { ToolbarDemo } from './components/toolbar-demo/toolbar-demo';
3030
import { TypographyDemo } from './components/core/typography-demo/typography-demo';
3131
import { TabDemo, ItemOneContent, ItemTwoContent, ItemThreeContent } from './components/tab-demo/tab-demo';
32-
import { Navbar } from './components/navigation/navbar';
3332
import { RippleDemo } from './components/core/ripple-demo/ripple-demo';
3433
import { SurfaceDemo } from './components/core/surface-demo/surface-demo';
3534

36-
import { Home } from './components/home/home';
35+
import { Home } from './home/home';
36+
import { AppToolbar } from './navigation/app-toolbar';
37+
import { Buttons } from './components/buttons/buttons';
38+
import { Core } from './components/core/core';
39+
import { InputsControls } from './components/inputs-controls/inputs-controls';
40+
import { GettingStarted } from './docs/getting-started';
3741

3842
import { demoAppRoutes } from './routes';
3943

@@ -45,11 +49,16 @@ import { demoAppRoutes } from './routes';
4549
ReactiveFormsModule,
4650
FlexLayoutModule,
4751
DemoMaterialModule,
48-
RouterModule.forRoot(demoAppRoutes, { useHash: true })
52+
RouterModule.forRoot(demoAppRoutes, { useHash: true, enableTracing: false })
4953
],
5054
declarations: [
5155
Home,
5256
AppComponent,
57+
AppToolbar,
58+
Buttons,
59+
Core,
60+
InputsControls,
61+
GettingStarted,
5362
ButtonDemo,
5463
CardDemo,
5564
CheckboxDemo,
@@ -62,7 +71,6 @@ import { demoAppRoutes } from './routes';
6271
LinearProgressDemo,
6372
ListDemo,
6473
MenuDemo,
65-
Navbar,
6674
RadioDemo,
6775
SliderDemo,
6876
SnackbarDemo,
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<div fxLayout="column" fxFlex.gt-xs="50" fxLayoutGap="15px" class="mdc-padding">
2+
<mdc-card *ngFor="let item of items" mdc-surface [routerLink]="[item.route]">
3+
<mdc-card-primary>
4+
<h1 mdc-card-title>{{item.name}}</h1>
5+
</mdc-card-primary>
6+
<mdc-card-supporting-text>
7+
{{item.desc}}
8+
</mdc-card-supporting-text>
9+
</mdc-card>
10+
</div>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Component } from '@angular/core';
2+
3+
import { buttons } from '../../navigation';
4+
5+
@Component({
6+
selector: 'buttons',
7+
templateUrl: './buttons.html'
8+
})
9+
export class Buttons {
10+
items = buttons.filter(_ => _.desc.length > 0);
11+
}

src/demo-app/components/fab-demo/fab-demo.html renamed to src/demo-app/components/buttons/fab-demo/fab-demo.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ <h1 mdc-typography-display1>Floating Action Button</h1>
3838
<td>tabIndex: number</td>
3939
<td>Set the tabindex of the button. (Default: 0).</td>
4040
</tr>
41+
<tr>
42+
<td>position: string</td>
43+
<td>Set absolute position. Valid values: 'bottom-left' | 'bottom-right' | null</td>
44+
</tr>
4145
</tbody>
4246
<thead>
4347
<tr>
@@ -97,5 +101,16 @@ <h1 mdc-typography-display1>Floating Action Button</h1>
97101
<span style="color:#89bdff">fontIcon</span>=<span style="color:#65b042">"fa-keyboard-o"</span>></span><span style="color:#89bdff">&lt;/<span style="color:#89bdff">mdc</span><span style="color:#89bdff">-icon</span>></span>
98102
<span style="color:#e0c589">&lt;/<span style="color:#e0c589">button</span>></span>
99103
</pre>
104+
105+
<span mdc-typography-headline>Absolute Positioning (bottom-right)</span>
106+
<button mdc-fab
107+
[position]="'bottom-right'">
108+
<mdc-icon>add</mdc-icon>
109+
</button>
110+
<pre style="background:#000;color:#f8f8f8"><span style="color:#e0c589">&lt;<span style="color:#e0c589">button</span> <span style="color:#e0c589">mdc-fab</span>
111+
[<span style="color:#e0c589">position</span>]=<span style="color:#65b042">"'bottom-right'"</span>></span>
112+
<span style="color:#89bdff">&lt;<span style="color:#89bdff">mdc</span><span style="color:#89bdff">-icon</span>></span>add<span style="color:#89bdff">&lt;/<span style="color:#89bdff">mdc</span><span style="color:#89bdff">-icon</span>></span>
113+
<span style="color:#e0c589">&lt;/<span style="color:#e0c589">button</span>></span>
114+
</pre>
100115
</div>
101116
</div>

src/demo-app/components/fab-demo/fab-demo.ts renamed to src/demo-app/components/buttons/fab-demo/fab-demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, ViewChild } from '@angular/core';
22

3-
import { MdcFabComponent } from '../../../lib/public_api';
3+
import { MdcFabComponent } from '../../../../lib/public_api';
44

55
@Component({
66
selector: 'fab-demo',

src/demo-app/components/core/core-demo.html

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

src/demo-app/components/core/core-demo.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<div fxLayout="column" fxFlex.gt-xs="50" fxLayoutGap="15px" class="mdc-padding">
2+
<mdc-card *ngFor="let item of items" mdc-surface [routerLink]="[item.route]">
3+
<mdc-card-primary>
4+
<h1 mdc-card-title>{{item.name}}</h1>
5+
</mdc-card-primary>
6+
<mdc-card-supporting-text>
7+
{{item.desc}}
8+
</mdc-card-supporting-text>
9+
</mdc-card>
10+
</div>

src/demo-app/components/core/core.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Component } from '@angular/core';
2+
3+
import { coreLinks } from '../../navigation';
4+
5+
@Component({
6+
selector: 'core',
7+
templateUrl: './core.html'
8+
})
9+
export class Core {
10+
items = coreLinks.filter(_ => _.desc.length > 0);
11+
}

src/demo-app/components/core/ripple-demo/ripple-demo.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<h1 mdc-typography-display1>Ripple</h1>
33
<div mdc-typography-subheading2>MDC Ripple provides components (or any element) with a material "ink ripple" interaction effect.</div>
44
<div class="info-banner" mdc-typography-subheading1>
5-
<![CDATA[import { MdcCoreModule } from '@angular-mdc/web';]]>
5+
<![CDATA[import { MdcRippleModule } from '@angular-mdc/web';]]>
66
</div>
77
<div class="docs-api">
88
<table>
@@ -30,7 +30,6 @@ <h1 mdc-typography-display1>Ripple</h1>
3030
</tbody>
3131
</table>
3232
</div>
33-
<span mdc-typography-headline>Using Ripple</span>
3433
<div fxLayout="column" fxLayoutAlign="start start" class="mdc-padding">
3534
<mdc-card class="demo-card mdc-padding" [mdc-ripple]="isRippleActive">
3635
<mdc-card-primary>

src/demo-app/components/core/surface-demo/surface-demo.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<h1 mdc-typography-display1>Surface</h1>
33
<div mdc-typography-subheading2>Provides components (or any element) with a material mouseover effect.</div>
44
<div class="info-banner" mdc-typography-subheading1>
5-
<![CDATA[import { MdcCoreModule } from '@angular-mdc/web';]]>
5+
<![CDATA[import { MdcRippleModule } from '@angular-mdc/web';]]>
66
</div>
77
<div class="docs-api">
88
<table>
@@ -32,7 +32,6 @@ <h1 mdc-typography-display1>Surface</h1>
3232
</div>
3333
</div>
3434
<div fxLayout="column" fxLayoutAlign="start start" class="mdc-padding">
35-
<span mdc-typography-headline>Using Surface</span>
3635
<mdc-card class="demo-card mdc-padding" [mdc-surface]="isSurfaceActive">
3736
<mdc-card-primary>
3837
<mdc-card-title>Card - Touch or Mouse over</mdc-card-title>

src/demo-app/components/core/typography-demo/typography-demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
} from '@angular/core';
44

55
@Component({
6-
selector: 'typography-progress-demo',
6+
selector: 'typography-demo',
77
templateUrl: './typography-demo.html'
88
})
99
export class TypographyDemo { }

src/demo-app/components/dialog-demo/dialog-demo.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div fxLayout="column" class="mdc-padding">
1+
<div fxLayout="column" fxLayoutAlign="start start" class="mdc-padding">
22
<h1 mdc-typography-display1>Dialog</h1>
33
<div mdc-typography-subheading2>Dialogs inform users about a specific task, require decisions, or involve multiple tasks.</div>
44
<div class="info-banner" mdc-typography-subheading1>
@@ -24,7 +24,7 @@ <h1 mdc-typography-display1>Dialog</h1>
2424
</thead>
2525
<tbody>
2626
<tr>
27-
<td>clickOutsideCloses: boolean</td>
27+
<td>clickOutsideToClose: boolean</td>
2828
<td>Close the dialog if user clicks on the backdrop. (Default: true)</td>
2929
</tr>
3030
<tr>
@@ -182,7 +182,7 @@ <h1 mdc-typography-display1>Dialog</h1>
182182
<span style="color:#89bdff">&lt;/<span style="color:#89bdff">mdc</span><span style="color:#89bdff">-dialog-body</span>></span>
183183
<span style="color:#89bdff">&lt;<span style="color:#89bdff">mdc</span><span style="color:#89bdff">-dialog-footer</span>></span>
184184
<span style="color:#e0c589">&lt;<span style="color:#e0c589">button</span> <span style="color:#e0c589">mdc-dialog-button</span> [<span style="color:#e0c589">cancel</span>]=<span style="color:#65b042">"true"</span>></span>Decline<span style="color:#e0c589">&lt;/<span style="color:#e0c589">button</span>></span>
185-
<span style="color:#e0c589">&lt;<span style="color:#e0c589">button</span> <span style="color:#e0c589">mdc-dialog-button</span> [<span style="color:#e0c589">action</span>]=<span style="color:#65b042">"true"</span> [<span style="color:#e0c589">accept</span>]=<span style="color:#65b042">"true"</span>></span>Accept<span style="color:#e0c589">&lt;/<span style="color:#e0c589">button</span>></span>
185+
<span style="color:#e0c589">&lt;<span style="color:#e0c589">button</span> <span style="color:#e0c589">mdc-dialog-button</span> [<span style="color:#e0c589">accept</span>]=<span style="color:#65b042">"true"</span>></span>Accept<span style="color:#e0c589">&lt;/<span style="color:#e0c589">button</span>></span>
186186
<span style="color:#89bdff">&lt;/<span style="color:#89bdff">mdc</span><span style="color:#89bdff">-dialog-footer</span>></span>
187187
<span style="color:#89bdff">&lt;/<span style="color:#89bdff">mdc</span><span style="color:#89bdff">-dialog</span>></span>
188188
</pre>
@@ -281,7 +281,7 @@ <h1 mdc-typography-display1>Dialog</h1>
281281
</mdc-dialog-body>
282282
<mdc-dialog-footer>
283283
<button mdc-dialog-button [cancel]="true">Decline</button>
284-
<button mdc-dialog-button [action]="true" [accept]="true">Accept</button>
284+
<button mdc-dialog-button [accept]="true">Accept</button>
285285
</mdc-dialog-footer>
286286
</mdc-dialog>
287287

@@ -303,14 +303,14 @@ <h1 mdc-typography-display1>Dialog</h1>
303303
</mdc-dialog-header>
304304
<mdc-dialog-body>
305305
<mdc-list [avatar]="true">
306-
<mdc-list-item (click)="closeDialogGmail();">
307-
<i mdc-list-item-start material-icon class="grey-avatar">person</i>[email protected]
306+
<mdc-list-item (click)="closeDialogGmail();" mdc-surface>
307+
<mdc-icon mdc-list-item-start class="grey-avatar">person</mdc-icon>[email protected]
308308
</mdc-list-item>
309-
<mdc-list-item (click)="closeDialogGmail();">
310-
<i mdc-list-item-start material-icon class="grey-avatar">person</i>[email protected]
309+
<mdc-list-item (click)="closeDialogGmail();" mdc-surface>
310+
<mdc-icon mdc-list-item-start class="grey-avatar">person</mdc-icon>[email protected]
311311
</mdc-list-item>
312-
<mdc-list-item (click)="closeDialogGmail();">
313-
<i mdc-list-item-start material-icon class="grey-avatar">add</i>add account
312+
<mdc-list-item (click)="closeDialogGmail();" mdc-surface>
313+
<mdc-icon mdc-list-item-start class="grey-avatar">add</mdc-icon>add account
314314
</mdc-list-item>
315315
</mdc-list>
316316
</mdc-dialog-body>

src/demo-app/components/drawer-demo/drawer-demo.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ <h1 mdc-typography-display1>Drawers</h1>
1616
<td>mdc-permanent-drawer</td>
1717
</tr>
1818
</tbody>
19+
<thead>
20+
<tr>
21+
<th>Properties</th>
22+
<th>Description</th>
23+
</tr>
24+
</thead>
25+
<tbody>
26+
<tr>
27+
<td>fixed: boolean</td>
28+
<td>Makes permanent drawer fixed on top and have persistent elevation.</td>
29+
</tr>
30+
</tbody>
1931
<thead>
2032
<tr>
2133
<th>Child Directives</th>

0 commit comments

Comments
 (0)