Skip to content

Commit

Permalink
fix(grid-list): hide overflow on tiles (angular#1299)
Browse files Browse the repository at this point in the history
  • Loading branch information
kara authored and josephperrott committed Sep 22, 2016
1 parent e160668 commit ee191f9
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 53 deletions.
1 change: 1 addition & 0 deletions src/lib/grid-list/grid-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ md-grid-list {
md-grid-tile {
display: block;
position: absolute;
overflow: hidden;

figure {
display: flex;
Expand Down
12 changes: 0 additions & 12 deletions src/lib/snack-bar/base-snack-bar.ts

This file was deleted.

29 changes: 0 additions & 29 deletions src/lib/snack-bar/package.json

This file was deleted.

4 changes: 2 additions & 2 deletions src/lib/snack-bar/simple-snack-bar.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
md-simple-snackbar {
display: flex;
justify-content: space-between;
display: flex;
justify-content: space-between;
}

.md-simple-snackbar-message {
Expand Down
16 changes: 14 additions & 2 deletions src/lib/snack-bar/simple-snack-bar.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
import {Component} from '@angular/core';
import {BaseSnackBarContent} from './base-snack-bar';
import {MdSnackBarRef} from './snack-bar-ref';


/**
* A component used to open as the default snack bar, matching material spec.
* This should only be used internally by the snack bar service.
*/
@Component({
moduleId: module.id,
selector: 'simple-snack-bar',
templateUrl: 'simple-snack-bar.html',
styleUrls: ['simple-snack-bar.css'],
})
export class SimpleSnackBar extends BaseSnackBarContent<SimpleSnackBar> {
export class SimpleSnackBar {
/** The message to be shown in the snack bar. */
message: string;

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

/** The instance of the component making up the content of the snack bar. */
snackBarRef: MdSnackBarRef<SimpleSnackBar>;

/** Dismisses the snack bar. */
dismiss(): void {
this.snackBarRef.dismiss();
}

/** If the action button should be shown. */
get hasAction(): boolean { return !!this.action; }
}
4 changes: 2 additions & 2 deletions src/lib/snack-bar/snack-bar-ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import {Subject} from 'rxjs/Subject';
*/
export class MdSnackBarRef<T> {
/** The instance of the component making up the content of the snack bar. */
readonly instance: T|any;
readonly instance: T;

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

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

constructor(instance: T|any, private _overlayRef: OverlayRef) {
constructor(instance: T, private _overlayRef: OverlayRef) {
// Sets the readonly instance of the snack bar content component.
this.instance = instance;
this.afterDismissed().subscribe(null, null, () => { this._isActive = false; });
Expand Down
14 changes: 8 additions & 6 deletions src/lib/snack-bar/snack-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import {
ComponentRef,
} from '@angular/core';
import {
Overlay,
OverlayState,
OverlayRef,
ComponentType,
ComponentPortal,
MdLiveAnnouncer,
Overlay,
OverlayModule,
OverlayRef,
OverlayState,
PortalModule,
OVERLAY_PROVIDERS,
} from '@angular2-material/core';
Expand All @@ -35,7 +36,8 @@ export class MdSnackBar {
/** A reference to the current snack bar in the view. */
private _snackBarRef: MdSnackBarRef<any>;

constructor(private _overlay: Overlay) {}
constructor(private _overlay: Overlay,
private _live: MdLiveAnnouncer) {}

/**
* Creates and dispatches a snack bar with a custom component for the content, removing any
Expand All @@ -59,6 +61,7 @@ export class MdSnackBar {
open(message: string, actionLabel: string,
config: MdSnackBarConfig): MdSnackBarRef<SimpleSnackBar> {
let simpleSnackBarRef = this.openFromComponent(SimpleSnackBar, config);
simpleSnackBarRef.instance.snackBarRef = simpleSnackBarRef;
simpleSnackBarRef.instance.message = message;
simpleSnackBarRef.instance.action = actionLabel;
return simpleSnackBarRef;
Expand Down Expand Up @@ -87,7 +90,6 @@ export class MdSnackBar {
let portal = new ComponentPortal(component);
let contentRef = container.attachComponentPortal(portal);
let snackBarRef = <MdSnackBarRef<T>> new MdSnackBarRef(contentRef.instance, overlayRef);
snackBarRef.instance.snackBarRef = snackBarRef;

this._snackBarRef = snackBarRef;
return snackBarRef;
Expand Down Expand Up @@ -118,7 +120,7 @@ export class MdSnackBarModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: MdSnackBarModule,
providers: [MdSnackBar, OVERLAY_PROVIDERS]
providers: [MdSnackBar, OVERLAY_PROVIDERS, MdLiveAnnouncer]
};
}
}

0 comments on commit ee191f9

Please sign in to comment.