Skip to content

docs(demos): add dialog demos #5666

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

Merged
merged 6 commits into from
Jul 17, 2017
Merged

docs(demos): add dialog demos #5666

merged 6 commits into from
Jul 17, 2017

Conversation

amcdnl
Copy link
Contributor

@amcdnl amcdnl commented Jul 11, 2017

Adds demos for:

  • Basic Dialog
  • Dialog Results
  • Dialog Content
  • Complex Dialog Overview
  • Enhanced docs for data purpose to be more clear when passing data

@amcdnl amcdnl requested a review from jelbourn July 11, 2017 00:03
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jul 11, 2017
@amcdnl
Copy link
Contributor Author

amcdnl commented Jul 11, 2017

When merged, will need to ensure this is merged at same time - angular/material.angular.io#216

@amcdnl amcdnl self-assigned this Jul 11, 2017
@jelbourn jelbourn requested a review from crisbeto July 11, 2017 18:28
@jelbourn
Copy link
Member

@crisbeto should also take a look

Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

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

A few nitpicks.

templateUrl: 'dialog-basic-example.html',
})
export class DialogBasicExample {
constructor(public dialog: MdDialog) {}
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't need to be public.

<md-dialog-content>Are you sure?</md-dialog-content>
<md-dialog-actions>
<button md-button tabindex="-1">Not Tabbable</button>
<button md-button [md-dialog-close]="true" tabindex="1">Yes</button>
Copy link
Member

Choose a reason for hiding this comment

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

A more realistic example for this case would be to have an input and have the md-dialog-close pass the input value back to the afterClosed.

Copy link
Contributor Author

@amcdnl amcdnl Jul 11, 2017

Choose a reason for hiding this comment

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

@crisbeto - I have this demo in the overview, do you think we need to do it here too?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I must've missed the one below.

<p> Hi, I'm a dialog! </p>
<h1 md-dialog-title>Hi {{data.name}}</h1>
<div md-dialog-content>
<p>Whats your favorite animal?</p>
Copy link
Member

Choose a reason for hiding this comment

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

Whats -> What's.

<ol>
<li>
<md-input-container>
<input mdInput [(ngModel)]="name" placeholder="Whats your name?">
Copy link
Member

Choose a reason for hiding this comment

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

Whats -> What's.

<li *ngIf="animal">
You chose: <i>{{animal}}</i>
</li>
</ol>
Copy link
Member

Choose a reason for hiding this comment

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

Missing trailing newline at the end of the file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Odd that linting isn't picking this up.

@@ -40,7 +40,8 @@ import {
MdToolbarModule,
MdTooltipModule,
MdPaginatorModule,
MdSortModule
MdSortModule,
MdTableModule
Copy link
Member

Choose a reason for hiding this comment

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

Looks like this adds MdTableModule for a second time (it's already defined on line 39).

Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

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

LGTM

@crisbeto crisbeto added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Jul 12, 2017
@jelbourn jelbourn removed the action: merge The PR is ready for merge by the caretaker label Jul 12, 2017
openDialog() {
this.dialog.open(DialogDataExampleDialog, {
data: {
animal: 'panda'
Copy link
Member

Choose a reason for hiding this comment

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

This data should come from an <input> next to the dialog open button, to demonstrate the value coming from the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Per our conversation, we discussed using the example of the overview to demonstrate this and keeping this demo basic.

/**
* @title Dialog Content
*/
@Component({
Copy link
Member

Choose a reason for hiding this comment

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

"Dialog content" by itself doesn't really communicate what this example is for. It should be something like
"Dialog with header, scrollable content, and actions". The content should be long enough to cause scrolling and wide enough that the actions are aligned to either the right or left of the dialog.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I addressed the scrolling and title, can you expand on what you had in mind for the button alignment?

import {MdDialog, MD_DIALOG_DATA} from '@angular/material';

/**
* @title Dialog Data Sharing
Copy link
Member

Choose a reason for hiding this comment

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

I'd call this "Injecting data when opening a dialog"

@@ -1,7 +1,7 @@
The `MdDialog` service can be used to open modal dialogs with Material Design styling and
animations.

<!-- example(dialog-overview) -->
<!-- example(dialog-basic) -->
Copy link
Member

Choose a reason for hiding this comment

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

Is this supposed to be dialog-overview?

I think we should probably get rid of this "dialog-basic" example because it is too basic; it doesn't really show anything. The first example really needs to showcase the component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Moved the first demo to the complex overview example.

@jelbourn
Copy link
Member

Also, nothing really highlights returning data from the dialog like we have now. I think this should be featured more predominantly.

In removing dialog-result as an example, you would also have to remove reference to it from documentation-items.ts (it's 404-ing now).

@amcdnl
Copy link
Contributor Author

amcdnl commented Jul 12, 2017

@jelbourn - Already done, see comment above referencing the PR - angular/material.angular.io#216

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.

LGTM

@jelbourn jelbourn added action: merge The PR is ready for merge by the caretaker pr: merge safe labels Jul 12, 2017
@jelbourn
Copy link
Member

@amcdnl lint error

ERROR: /home/travis/build/angular/material2/src/material-examples/dialog-content/dialog-content-example.ts[18, 1]: trailing whitespace

@elvirdolic
Copy link

It would be great to share an example with async data and how to share data.

@jelbourn jelbourn removed the action: merge The PR is ready for merge by the caretaker label Jul 14, 2017
@jelbourn
Copy link
Member

@amcdnl you can add the "merge_ready" label back after fixing the lint warning

@amcdnl amcdnl added the action: merge The PR is ready for merge by the caretaker label Jul 15, 2017
@jelbourn jelbourn merged commit 5962c93 into angular:master Jul 17, 2017
@amcdnl amcdnl deleted the dialog-demos branch July 20, 2017 14:46
@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.

5 participants