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

Commit d7f516c

Browse files
authored
refactor: Library improvements + refactoring (#329)
Closes #328
1 parent 8dd1470 commit d7f516c

File tree

111 files changed

+1256
-1387
lines changed

Some content is hidden

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

111 files changed

+1256
-1387
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"lint": "npm run lint:ts && npm run lint:css",
3737
"lint:ts": "tslint 'src/**/*.ts test/**/*.ts'",
3838
"lint:css": "stylelint src/**/*.scss --config .stylelint-config.yaml",
39+
"fix:css": "stylelint --fix src/**/*.scss --config .stylelint-config.yaml",
3940
"test": "npm run test:unit",
4041
"test:unit": "karma start --single-run",
4142
"test:watch": "karma start --auto-watch",

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { Component, ViewChild } from '@angular/core';
22

3-
import { MdcFabComponent } from '../../../../lib/public_api';
3+
// import { MdcFab } from '@angular-mdc/web';
4+
import { MdcFab } from '../../../../lib/public_api';
45

56
@Component({
67
selector: 'fab-demo',
78
templateUrl: './fab-demo.html'
89
})
910
export class FabDemo {
10-
@ViewChild('fab') fab: MdcFabComponent;
11+
@ViewChild('fab') fab: MdcFab;
1112
isMini: boolean = false;
1213
isExited: boolean = false;
1314
isRippleDisabled: boolean = false;

src/demo-app/components/buttons/icon-toggle-demo/icon-toggle-demo.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { Component } from '@angular/core';
66
})
77
export class IconToggleDemo {
88
isOn: boolean = false;
9-
isDisabled: boolean;
10-
isPrimary: boolean;
11-
isAccent: boolean;
12-
isDarkTheme: boolean;
9+
isDisabled: boolean = false;
10+
isPrimary: boolean = false;
11+
isAccent: boolean = false;
12+
isDarkTheme: boolean = false;
1313
}

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Component, ViewChild } from '@angular/core';
22
import { FormControl, FormGroup, Validators } from '@angular/forms';
33

4-
import { MdcDialogComponent, MdcTextfield } from '../../../lib/public_api';
4+
// import { MdcDialog, MdcTextfield } from '@angular-mdc/web';
5+
import { MdcDialog, MdcTextfield } from '../../../lib/public_api';
56

67
@Component({
78
selector: 'dialog-demo',
@@ -11,11 +12,11 @@ export class DialogDemo {
1112
userForm: FormGroup;
1213

1314
@ViewChild('input') input: MdcTextfield;
14-
@ViewChild('dialog') dialog: MdcDialogComponent;
15-
@ViewChild('dialogscroll') dialogScroll: MdcDialogComponent;
16-
@ViewChild('dialogalert') dialogAlert: MdcDialogComponent;
17-
@ViewChild('dialoggmail') dialogGmail: MdcDialogComponent;
18-
@ViewChild('dialogform') dialogForm: MdcDialogComponent;
15+
@ViewChild('dialog') dialog: MdcDialog;
16+
@ViewChild('dialogscroll') dialogScroll: MdcDialog;
17+
@ViewChild('dialogalert') dialogAlert: MdcDialog;
18+
@ViewChild('dialoggmail') dialogGmail: MdcDialog;
19+
@ViewChild('dialogform') dialogForm: MdcDialog;
1920

2021
ngOnInit() {
2122
this.userForm = new FormGroup({

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

Lines changed: 146 additions & 141 deletions
Large diffs are not rendered by default.

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@ import {
33
ViewChild
44
} from '@angular/core';
55

6-
import {
7-
MdcTemporaryDrawerComponent,
8-
MdcPersistentDrawerComponent
9-
} from '../../../lib/public_api';
6+
// import { MdcTemporaryDrawer, MdcPersistentDrawer } from '@angular-mdc/web';
7+
import { MdcTemporaryDrawer, MdcPersistentDrawer } from '../../../lib/public_api';
108

119
@Component({
1210
selector: 'drawer-demo',
1311
templateUrl: './drawer-demo.html'
1412
})
1513
export class DrawerDemo {
16-
@ViewChild('temporary') temporaryDrawer: MdcTemporaryDrawerComponent;
17-
@ViewChild('persistent') persistentDrawer: MdcPersistentDrawerComponent;
14+
@ViewChild('temporary') temporaryDrawer: MdcTemporaryDrawer;
15+
@ViewChild('persistent') persistentDrawer: MdcPersistentDrawer;
1816

1917
handleTemporary() {
2018
this.temporaryDrawer.open();

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ <h1 mdc-typography-display1>Snackbar</h1>
123123
@Component({
124124
selector: 'snackbar-demo',
125125
templateUrl: './snackbar-demo.component.html',
126-
providers: [MdcSnackbar],
127126
})
128127
export class SnackbarDemoComponent {
129128
message = 'Message deleted';

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

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

3+
// import { MdcSnackbar } from '@angular-mdc/web';
34
import { MdcSnackbar } from '../../../lib/public_api';
45

56
@Component({
67
selector: 'snackbar-demo',
78
templateUrl: './snackbar-demo.html',
8-
providers: [MdcSnackbar],
99
})
1010
export class SnackbarDemo {
1111
message = 'Message deleted';
Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,16 @@
11
<div class="mdc-padding">
22
<h1 id="angularmdcgettingstarted">Angular MDC - Getting started</h1>
33

4-
<ul>
5-
<li><a href="#step1">Step 1 - Install Angular MDC</a></li>
6-
7-
<li><a href="#step2">Step 2 - Import Components</a></li>
8-
9-
<li><a href="#step3">Step 3 - Import Theme</a></li>
10-
11-
<li><a href="#step4">Step 4 - Include Material Design Icons</a></li>
12-
13-
<li><a href="#step5">Step 5 - Include Roboto Font</a></li>
14-
</ul>
15-
164
<h2 id="usingangularcli">Using Angular CLI?</h2>
175

186
<p>If you intend to use Angular CLI, please reference <a href="https://github.com/trimox/angular-mdc-web/blob/master/docs/guide-angular-cli.md">Angular CLI - Getting Started guide</a>.</p>
197

208
<h2 id="anamestep1astep1installangularmdc"><a name="step1"></a> Step 1: Install Angular MDC</h2>
219

22-
<pre><code>npm i @angular-mdc/web
23-
</code></pre>
10+
<pre>npm i @angular-mdc/web</pre>
2411

2512
<h2 id="anamestep2astep2importcomponents"><a name="step2"></a> Step 2: Import Components</h2>
26-
27-
<h3 id="allcomponents">All components</h3>
28-
29-
<pre><![CDATA[import { MaterialModule } from '@angular-mdc/web';
30-
31-
@NgModule({
32-
...
33-
imports: [MaterialModule],
34-
...
35-
})
36-
export class ExampleModule { }
37-
]]></pre>
38-
39-
<h3 id="orindividualcomponents">Or individual components</h3>
40-
13+
Add an import of MdcCoreModule to provide ripple, typography, and elevation functionality. Now just import the NgModule for each component you want to use.
4114
<pre><![CDATA[import {
4215
MdcCoreModule, // required
4316
MdcFabModule,
@@ -61,25 +34,23 @@ <h2 id="anamestep3astep3importangularmdctheme"><a name="step3"></a> Step 3: Impo
6134

6235
<p>Import the Angular MDC theme into your project Sass:</p>
6336

64-
<pre><code class="sass language-sass">$mdc-theme-primary: #1565c0; // change primary color example
37+
<pre>$mdc-theme-primary: #1565c0; // change primary color example
6538
$mdc-theme-secondary: #388e3c; // change secondary color example
6639

6740
@import "~@angular-mdc/theme/material";
68-
</code></pre>
41+
</pre>
6942

7043
<h2 id="anamestep4astep4includematerialdesignicons"><a name="step4"></a> Step 4: Include Material Design Icons</h2>
7144

7245
<p>Add the <a href="https://material.io/icons/">Material Design Icons</a> collection to your <code>index.html</code>.</p>
7346

74-
<pre><code class="html language-html">&lt;link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"&gt;
75-
</code></pre>
47+
<pre>&lt;link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"&gt;</pre>
7648

7749
<h2 id="anamestep5astep5includerobotofont"><a name="step5"></a> Step 5: Include Roboto Font</h2>
7850

7951
<p>Add the Roboto font with 300, 400 and 500 weights to your <code>index.html</code>.</p>
8052

81-
<pre><code class="html language-html">&lt;link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet"&gt;
82-
</code></pre>
53+
<pre>&lt;link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet"&gt;</pre>
8354

84-
<h3 id="alldone">All done!</h3>
55+
<h3 id="alldone">All set!</h3>
8556
</div>

src/demo-app/home/home.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ <h2 mdc-typography-display2 mdc-typography-adjust-margin fxShow fxHide.xs="true"
1111
<button fxFlexOffset="25px" [raised]="true" [secondary]="true" mdc-button [routerLink]="['getting-started']">Get Started</button>
1212
</mdc-card>
1313
<div mdc-typography-caption fxFlexOffset="40px" fxLayout="column" fxLayoutAlign="center center">
14-
<span>angular-mdc-web v0.5.5</span>
14+
<span>angular-mdc-web v0.5.6</span>
1515
<span>material-components-web v0.23.0</span>
1616
</div>
1717
</div>

0 commit comments

Comments
 (0)