Skip to content

Commit a1d68c3

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

File tree

7 files changed

+29
-54
lines changed

7 files changed

+29
-54
lines changed

src/lib/grid-list/grid-list.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ md-grid-list {
2020
md-grid-tile {
2121
display: block;
2222
position: absolute;
23+
overflow: hidden;
2324

2425
figure {
2526
display: flex;

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-ref.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ import {Subject} from 'rxjs/Subject';
1010
*/
1111
export class MdSnackBarRef<T> {
1212
/** The instance of the component making up the content of the snack bar. */
13-
readonly instance: T|any;
13+
readonly instance: T;
1414

1515
/** Subject for notifying the user that the snack bar has closed. */
1616
private _afterClosed: Subject<any> = new Subject();
1717

1818
/** If the snack bar is active. */
1919
private _isActive: boolean = true;
2020

21-
constructor(instance: T|any, private _overlayRef: OverlayRef) {
21+
constructor(instance: T, private _overlayRef: OverlayRef) {
2222
// Sets the readonly instance of the snack bar content component.
2323
this.instance = instance;
2424
this.afterDismissed().subscribe(null, null, () => { this._isActive = false; });

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ import {
55
ComponentRef,
66
} from '@angular/core';
77
import {
8-
Overlay,
9-
OverlayState,
10-
OverlayRef,
118
ComponentType,
129
ComponentPortal,
10+
MdLiveAnnouncer,
11+
Overlay,
1312
OverlayModule,
13+
OverlayRef,
14+
OverlayState,
1415
PortalModule,
1516
OVERLAY_PROVIDERS,
1617
} from '@angular2-material/core';
@@ -35,7 +36,8 @@ export class MdSnackBar {
3536
/** A reference to the current snack bar in the view. */
3637
private _snackBarRef: MdSnackBarRef<any>;
3738

38-
constructor(private _overlay: Overlay) {}
39+
constructor(private _overlay: Overlay,
40+
private _live: MdLiveAnnouncer) {}
3941

4042
/**
4143
* Creates and dispatches a snack bar with a custom component for the content, removing any
@@ -49,7 +51,8 @@ export class MdSnackBar {
4951
let overlayRef = this._createOverlay();
5052
let snackBarContainer = this._attachSnackBarContainer(overlayRef, config);
5153

52-
return this._attachSnackbarContent(component, snackBarContainer, overlayRef);
54+
let mdSnackBarRef = this._attachSnackbarContent(component, snackBarContainer, overlayRef);
55+
return mdSnackBarRef;
5356
}
5457

5558

@@ -59,6 +62,7 @@ export class MdSnackBar {
5962
open(message: string, actionLabel: string,
6063
config: MdSnackBarConfig): MdSnackBarRef<SimpleSnackBar> {
6164
let simpleSnackBarRef = this.openFromComponent(SimpleSnackBar, config);
65+
simpleSnackBarRef.instance.snackBarRef = simpleSnackBarRef;
6266
simpleSnackBarRef.instance.message = message;
6367
simpleSnackBarRef.instance.action = actionLabel;
6468
return simpleSnackBarRef;
@@ -87,7 +91,6 @@ export class MdSnackBar {
8791
let portal = new ComponentPortal(component);
8892
let contentRef = container.attachComponentPortal(portal);
8993
let snackBarRef = <MdSnackBarRef<T>> new MdSnackBarRef(contentRef.instance, overlayRef);
90-
snackBarRef.instance.snackBarRef = snackBarRef;
9194

9295
this._snackBarRef = snackBarRef;
9396
return snackBarRef;
@@ -118,7 +121,7 @@ export class MdSnackBarModule {
118121
static forRoot(): ModuleWithProviders {
119122
return {
120123
ngModule: MdSnackBarModule,
121-
providers: [MdSnackBar, OVERLAY_PROVIDERS]
124+
providers: [MdSnackBar, OVERLAY_PROVIDERS, MdLiveAnnouncer]
122125
};
123126
}
124127
}

0 commit comments

Comments
 (0)