Skip to content

Commit e6cdd55

Browse files
karajosephperrott
authored andcommitted
fix(grid-list): hide overflow on tiles (#1299)
1 parent d3d9f73 commit e6cdd55

15 files changed

+89
-71
lines changed

src/demo-app/snack-bar/snack-bar-demo.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ <h1>SnackBar demo</h1>
22
<div>
33
<div>Message: <md-input type="text" [(ngModel)]="message"></md-input></div>
44
<div>
5-
<md-checkbox [(ngModel)]="action">Show button</md-checkbox>
6-
<md-input type="text" class="button-label-input"
7-
placeholder="Snack bar action label"
8-
[disabled]="!action"
9-
[(ngModel)]="actionButtonLabel"></md-input>
5+
<md-checkbox [(ngModel)]="action">
6+
<p *ngIf="!action">Show button on snack bar</p>
7+
<md-input type="text" class="button-label-input"
8+
*ngIf="action"
9+
placeholder="Snack bar action label"
10+
[(ngModel)]="actionButtonLabel"></md-input>
11+
</md-checkbox>
1012
</div>
1113
</div>
1214

src/demo-app/snack-bar/snack-bar-demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Component, ViewContainerRef} from '@angular/core';
2-
import {MdSnackBar, MdSnackBarConfig} from '@angular2-material/snack-bar';
2+
import {MdSnackBar, MdSnackBarConfig} from '@angular/material';
33

44
@Component({
55
moduleId: module.id,

src/lib/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export * from './select/index';
1818
export * from './sidenav/index';
1919
export * from './slider/index';
2020
export * from './slide-toggle/index';
21+
export * from './snack-bar/index';
2122
export * from './tabs/index';
2223
export * from './toolbar/index';
2324
export * from './tooltip/index';

src/lib/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {MdIconModule} from './icon/index';
2323
import {MdProgressCircleModule} from './progress-circle/index';
2424
import {MdProgressBarModule} from './progress-bar/index';
2525
import {MdInputModule} from './input/index';
26-
import {MdSnackBarModule} from '@angular2-material/snack-bar';
26+
import {MdSnackBarModule} from './snack-bar/snack-bar';
2727
import {MdTabsModule} from './tabs/index';
2828
import {MdToolbarModule} from './toolbar/index';
2929
import {MdTooltipModule} from './tooltip/index';

src/lib/snack-bar/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# MdSnackBar
2+
`MdSnackBar` is a service, which opens snack bar notifications in the view.
3+
4+
### Methods
5+
6+
| Name | Description |
7+
| --- | --- |
8+
| `open(message: string,<br> actionLabel: string, config: MdSnackBarConfig): MdSnackBarRef<SimpleSnackBar>` | Creates and opens a simple snack bar noticiation matching material spec. |
9+
| `openFromComponent(component: ComponentType<T>, config: MdSnackBarConfig): MdSnackBarRef<T>` | Creates and opens a snack bar noticiation with a custom component as content. |
10+
11+
### Config
12+
13+
| Key | Description |
14+
| --- | --- |
15+
| `viewContainerRef: ViewContainerRef` | The view container ref to attach the snack bar to. |
16+
| `role: AriaLivePoliteness = 'assertive'` | The politeness level to announce the snack bar with. |
17+
| `announcementMessage: string` | The message to announce with the snack bar. |
18+
19+
20+
### Example
21+
The service can be injected in a component.
22+
```ts
23+
@Component({
24+
selector: 'my-component'
25+
providers: [MdSnackBar]
26+
})
27+
export class MyComponent {
28+
29+
constructor(snackBar: MdSnackBar
30+
viewContainerRef: ViewContainerRef) {}
31+
32+
failedAttempt() {
33+
config = new MdSnackBarConfig(this.viewContainerRef);
34+
this.snackBar.open('It didn\'t quite work!', 'Try Again', config);
35+
}
36+
37+
}
38+
```

src/lib/snack-bar/base-snack-bar.ts

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

src/lib/snack-bar/package.json

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

src/lib/snack-bar/simple-snack-bar.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
md-simple-snackbar {
2-
display: flex;
3-
justify-content: space-between;
2+
display: flex;
3+
justify-content: space-between;
44
}
55

66
.md-simple-snackbar-message {

src/lib/snack-bar/simple-snack-bar.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
import {Component} from '@angular/core';
2-
import {BaseSnackBarContent} from './base-snack-bar';
2+
import {MdSnackBarRef} from './snack-bar-ref';
33

44

5+
/**
6+
* A component used to open as the default snack bar, matching material spec.
7+
* This should only be used internally by the snack bar service.
8+
*/
59
@Component({
610
moduleId: module.id,
711
selector: 'simple-snack-bar',
812
templateUrl: 'simple-snack-bar.html',
913
styleUrls: ['simple-snack-bar.css'],
1014
})
11-
export class SimpleSnackBar extends BaseSnackBarContent<SimpleSnackBar> {
15+
export class SimpleSnackBar {
1216
/** The message to be shown in the snack bar. */
1317
message: string;
1418

1519
/** The label for the button in the snack bar. */
1620
action: string;
1721

22+
/** The instance of the component making up the content of the snack bar. */
23+
snackBarRef: MdSnackBarRef<SimpleSnackBar>;
24+
25+
/** Dismisses the snack bar. */
26+
dismiss(): void {
27+
this.snackBarRef.dismiss();
28+
}
29+
1830
/** If the action button should be shown. */
1931
get hasAction(): boolean { return !!this.action; }
2032
}

src/lib/snack-bar/snack-bar-config.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import {ViewContainerRef} from '@angular/core';
2+
import {AriaLivePoliteness} from '../core';
23

34

4-
export type SnackBarRole = 'alert' | 'polite';
5-
65
export class MdSnackBarConfig {
7-
/** The aria-role of the snack bar. */
8-
role: SnackBarRole = 'alert';
6+
/** The politeness level for the MdAriaLiveAnnouncer announcement. */
7+
politeness: AriaLivePoliteness = 'assertive';
8+
9+
/** Message to be announced by the MdAriaLiveAnnouncer */
10+
announcementMessage: string;
911

1012
/** The view container to place the overlay for the snack bar into. */
1113
viewContainerRef: ViewContainerRef;

0 commit comments

Comments
 (0)