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,
File renamed without changes.
File renamed without changes.
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',

0 commit comments

Comments
 (0)