forked from angular/components
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dialog): add dialog content elements
Adds the following dialog-specific directives: * `md-dialog-close` - Closes the current dialog. * `md-dialog-title` - Title of a dialog. * `md-dialog-content` - Scrollable content for a dialog. * `md-dialog-actions` - Container for the bottom buttons in a dialog. Fixes angular#1624. Fixes angular#2042.
- Loading branch information
Showing
11 changed files
with
316 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import {Directive} from '@angular/core'; | ||
import {MdDialog} from './dialog'; | ||
|
||
|
||
/** | ||
* Button that will close the current dialog. | ||
*/ | ||
@Directive({ | ||
selector: 'button[md-dialog-close]', | ||
host: { | ||
'(click)': 'dialog.closeTop()' | ||
} | ||
}) | ||
export class MdDialogClose { | ||
constructor(public dialog: MdDialog) { } | ||
} | ||
|
||
/** | ||
* Title of a dialog element. Stays fixed to the top of the dialog when scrolling. | ||
*/ | ||
@Directive({ | ||
selector: '[md-dialog-title]', | ||
host: { | ||
role: 'heading' | ||
} | ||
}) | ||
export class MdDialogTitle { } | ||
|
||
|
||
/** | ||
* Scrollable content container of a dialog. | ||
*/ | ||
@Directive({ | ||
selector: '[md-dialog-content], md-dialog-content', | ||
host: { | ||
role: 'main' | ||
} | ||
}) | ||
export class MdDialogContent { } | ||
|
||
|
||
/** | ||
* Container for the bottom action buttons in a dialog. | ||
* Stays fixed to the bottom when scrolling. | ||
*/ | ||
@Directive({ | ||
selector: '[md-dialog-actions], md-dialog-actions' | ||
}) | ||
export class MdDialogActions { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
@import '../core/style/elevation'; | ||
@import '../core/a11y/a11y'; | ||
|
||
|
||
$md-dialog-padding: 24px !default; | ||
$md-dialog-border-radius: 2px !default; | ||
$md-dialog-max-width: 80vw !default; | ||
$md-dialog-max-height: 65vh !default; | ||
|
||
md-dialog-container { | ||
@include md-elevation(24); | ||
|
||
display: block; | ||
padding: $md-dialog-padding; | ||
border-radius: $md-dialog-border-radius; | ||
box-sizing: border-box; | ||
overflow: auto; | ||
max-width: $md-dialog-max-width; | ||
|
||
// The dialog container should completely fill its parent overlay element. | ||
width: 100%; | ||
height: 100%; | ||
|
||
@include md-high-contrast { | ||
outline: solid 1px; | ||
} | ||
} | ||
|
||
md-dialog-content, [md-dialog-content] { | ||
display: block; | ||
margin: 0 $md-dialog-padding * -1; | ||
padding: 0 $md-dialog-padding; | ||
max-height: $md-dialog-max-height; | ||
overflow: auto; | ||
} | ||
|
||
[md-dialog-title] { | ||
font-size: rem(2); | ||
font-weight: bold; | ||
letter-spacing: 0.005em; | ||
margin: 0 0 rem(2); | ||
display: block; | ||
} | ||
|
||
md-dialog-actions, [md-dialog-actions] { | ||
padding: $md-dialog-padding / 2 0; | ||
display: block; | ||
|
||
&:last-child { | ||
margin-bottom: -$md-dialog-padding; | ||
} | ||
} |
Oops, something went wrong.