Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dialog): add configurable width, height and position #1848

Merged
merged 1 commit into from
Nov 30, 2016

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Nov 13, 2016

  • Adds the ability to set a dialog's width and height.
  • Adds the ability to set a dialog's position. If only the position in one axis is overridden, the other axis will stay centered.
  • Fixes the GlobalPositionStrategy adding an unnecessary 0px transform.
  • Makes the dialog scrollable.
  • Adds more options to the dialog demo so it's easier to test them out.

Fixes #1698.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Nov 13, 2016
@crisbeto crisbeto force-pushed the 1698/dialog-position-size branch 3 times, most recently from d8fc95c to 1bb14f1 Compare November 16, 2016 16:13
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also add tests for dialog that the explicit size/position are passed through.

@@ -1,3 +1,8 @@
.demo-dialog {
color: rebeccapurple;
}

md-card {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use a class with demo- prefix for this?


if (value === '100%') {
// When the width is 100%, we should reset the `left` and the offset,
// in order to ensure that the element is flush against the viewport edge.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put the comment on top of the if?

    // When the width is 100%, we should reset the `left` and the offset,
    // in order to ensure that the element is flush against the viewport edge.
    if (value === '100%') {
      this.left('0px');
    }

(here and in height)

/**
* Centers the overlay horizontally with an optional offset.
* Clears any previously set horizontal position.
*/
centerHorizontally(offset = '0px') {
centerHorizontally(offset?: string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also do

centerHorizontally(offset = '') {

padding: $md-dialog-padding;
border-radius: $md-dialog-border-radius;
width: 100%;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment like

// The dialog container should completely fill its parent overlay element.

.centerVertically();
state.positionStrategy = strategy;

// TODO(crisbeto): replace with `horizontal` to support RTL?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that if someone is manually setting the position of the dialog that they should be in change of dealing with RTL.

* Adds the ability to set a dialog's `width` and `height`.
* Adds the ability to set a dialog's position. If only the position in one axis is overridden, the other axis will stay centered.
* Fixes the `GlobalPositionStrategy` adding an unnecessary `0px` transform.
* Makes the dialog scrollable.
* Adds more options to the dialog demo so it's easier to test them out.

Fixes angular#1698.
@crisbeto
Copy link
Member Author

Addressed the feedback @jelbourn

@jelbourn
Copy link
Member

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Nov 18, 2016
@tinayuangao tinayuangao merged commit bc6cf6e into angular:master Nov 30, 2016
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MdDialog Feature Request: Ability to change Width and off-set
4 participants