Skip to content

docs(expansion): create overview and examples #5823

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 19 commits into from
Jul 27, 2017
Merged

docs(expansion): create overview and examples #5823

merged 19 commits into from
Jul 27, 2017

Conversation

julianobrasil
Copy link
Contributor

Fix #5568

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jul 17, 2017
templateUrl: 'expansion-overview-example.html',
})
export class ExpansionStepsExample {
public step = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

@jelbourn - Do you prefer explicit public? I haven't seen this in other places.

Copy link
Member

Choose a reason for hiding this comment

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

Nope, in fact our coding standards specifically say to omit it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated it.

Copy link
Contributor Author

@julianobrasil julianobrasil left a comment

Choose a reason for hiding this comment

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

Updated the code ommiting 'public' keyword.

templateUrl: 'expansion-overview-example.html',
})
export class ExpansionStepsExample {
public step = 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated it.


Each expansion has a header and an action sections. The header section is always visible at the top of the component and contains a title and a description subsections. The action section is fixed at the bottom, being visible when the expansion is in expanded state

When grouped by an `<md-accordion>` element, the expansions can be used for the creation of flows, as it brings up the possibility to expand one view at a time.
Copy link
Member

Choose a reason for hiding this comment

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

The doc structure should be

  1. Short, one-sentence summary of the component
  2. Overview example
  3. Expanded description of the component
  4. Other component specific sections
  5. Accessibility section


### Accordion

It's possible to group expansions in a fancy way. The `multi="true"` input allows the expansions state to be set independently of each other. When `multi="false"` (default) just one expansion can be expanded at a given time:
Copy link
Member

Choose a reason for hiding this comment

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

It's possible to group expansions in a fancy way.

This isn't really a helpful sentence. Instead I would say something like "Multiple expansion panels can be combined into an accordion"

@julianobrasil
Copy link
Contributor Author

I've changed it.

@@ -0,0 +1,81 @@
`<md-expansion-panel>` provides a way to show and hide lightweight content, by collapsing and expanding a view with a nice animation.
Copy link
Member

Choose a reason for hiding this comment

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

`<md-expansion-panel>` provides a expandable details-summary view.

Statements like "with a nice animation" are subjective. The docs should aim to be more "just the facts".

The word "lightweight" from the spec doesn't really have any bearing on the implementation. The designers used this word in the spec to communicate that people shouldn't dump an entire application inside an expansion panel.


The `expanded` input allows to choose among the collapsed or expanded state.

Each expansion panel has a header and an action sections. The header section is always visible at the top of the component and contains a title and a description subsections. The action section is fixed at the bottom, being visible when the expansion is in expanded state.
Copy link
Member

Choose a reason for hiding this comment

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

The header is required but the actions are optional


Each expansion panel has a header and an action sections. The header section is always visible at the top of the component and contains a title and a description subsections. The action section is fixed at the bottom, being visible when the expansion is in expanded state.

When grouped by an `<md-accordion>` element the expansion panels can be used to create ordered views or flows, as it brings up the possibility to expand one view at a time.
Copy link
Member

Choose a reason for hiding this comment

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

I would eliminate this sentence since we talk about accordions in their own section.


When grouped by an `<md-accordion>` element the expansion panels can be used to create ordered views or flows, as it brings up the possibility to expand one view at a time.

### Events
Copy link
Member

Choose a reason for hiding this comment

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

Don't need a section for events since this is captured in the API docs


<!-- example(expansion-overview) -->

The `expanded` input allows to choose among the collapsed or expanded state.
Copy link
Member

Choose a reason for hiding this comment

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

I would omit this bit about the expanded property because it will be captured via API docs and examples.


The `expanded` input allows to choose among the collapsed or expanded state.

Each expansion panel has a header and an action sections. The header section is always visible at the top of the component and contains a title and a description subsections. The action section is fixed at the bottom, being visible when the expansion is in expanded state.
Copy link
Member

Choose a reason for hiding this comment

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

I would start a new section here like

### Expansion panel content

And then talk about the header, actions, title, and description.

width: 100%;
text-align: right;
margin-top: 5px;
color: blue;
Copy link
Member

Choose a reason for hiding this comment

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

Too much indent (should be +2, not +4)

Copy link
Contributor

@rafaelss95 rafaelss95 Jul 23, 2017

Choose a reason for hiding this comment

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

@julianobrasil I think you're missing an eof newline here (see Travis).

Also, I'm not 100% sure, but I think all css classes under material-examples folder, should be prefixed with example-.

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, @rafaelss95 .

Copy link
Contributor

Choose a reason for hiding this comment

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

You forgot to change headers-align.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops! Done.

@julianobrasil
Copy link
Contributor Author

Changed.

Copy link
Contributor

@willshowell willshowell left a comment

Choose a reason for hiding this comment

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

Also I think the general preference in this repo is to break markdown text lines at 100 characters


The header section is always visible at the top of the component and contains a `<md-panel-title>` and a description `<md-panel-description>` subsections.

The `<md-panel-title>` subsecion is shown in the begining of the header, followed by the `<md-panel-description>` subsection, which is supposed to contain a sumary of what's in the expansion content.
Copy link
Contributor

Choose a reason for hiding this comment

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

typos: subsecion -> subsection, begining -> beginning, sumary -> summary

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


The `<md-panel-title>` subsecion is shown in the begining of the header, followed by the `<md-panel-description>` subsection, which is supposed to contain a sumary of what's in the expansion content.

By default, the expansion panel header has a toogle sign at the right edge, pointing up when the panel is expanded and down when it's collapsed. The toogle icon can be hidden by setting the input property `toogleHide` to `true`.
Copy link
Contributor

Choose a reason for hiding this comment

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

toogle -> toggle (multiple)
"toggle sign" -> "toggle icon"

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


#### Actions

The actions section is optional and fixed at the bottom, being visible only when the expansion is in its expanded state.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can remove "being"

"...at the bottom, visible only when"

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

@julianobrasil
Copy link
Contributor Author

julianobrasil commented Jul 20, 2017

@willshowell, manually (with simple <ENTER>)?

@mackelito
Copy link

just a FYI,
when using this code the title "jumps" when expanding/collapsing and the icon does not animate when rotating

<md-accordion>
  
  <md-expansion-panel multi="false">
    <md-expansion-panel-header>
      This is the expansion 1 title
    </md-expansion-panel-header>
    
    This the expansion 1 content
    
  </md-expansion-panel>
  
  <md-expansion-panel>
    <md-expansion-panel-header>
      This is the expansion 2 title
    </md-expansion-panel-header>
    
    This the expansion 2 content
    
  </md-expansion-panel>

</md-accordion>

@julianobrasil
Copy link
Contributor Author

julianobrasil commented Jul 20, 2017

@mackelito, I noticed it. It wasn't like this. It's maybe something with the late build.

BTW I moved the multi="false" to md-accordion where it should be.

Edited: Apparently has the same root cause of #5623 and has a PR (#5650).

@@ -0,0 +1,86 @@
`<md-expansion-panel>` provides a way to show and hide content, by collapsing and expanding a
view with animation.
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 prefer to phrase this as

`<md-expansion-panel>` provides a expandable details-summary view.

#### Header

The header section is always visible at the top of the component and contains a `<md-panel-title>`
and a description `<md-panel-description>` subsections.
Copy link
Member

Choose a reason for hiding this comment

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

I would replace this paragraph and the next with

The `<md-expansion-panel-header>` shows a summary of the panel content and acts
as the control for expanding and collapsing. This header may optionally contain an
`<md-panel-title>` and an `<md-panel-description>`, which format the content of the
header to align with Material Design specifications.


By default, the expansion panel header has a toggle icon at the right edge, pointing up when
the panel is expanded and down when it's collapsed. The toggle icon can be hidden by setting the
input property `hideToggle` to `true`.
Copy link
Member

Choose a reason for hiding this comment

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

By default, the expansion-panel header includes a toggle icon at the end of the
header to indicate the expansion state. This icon can be hidden via the 
`hideToggle` property.


<!-- example(expansion-overview) -->

### Expansion panel content
Copy link
Member

Choose a reason for hiding this comment

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

Expansion-panel
(here and elsewhere)


### Expansion panel content

Each expansion panel has a header section (mandatory) and an actions (optional) sections.
Copy link
Member

Choose a reason for hiding this comment

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

Each expansion panel must include a header and may optionally include an action bar.

</md-panel-description>
</md-expansion-panel-header>

<p>...</p>
Copy link
Member

Choose a reason for hiding this comment

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

<p>This is the primary content of the panel.</p>


#### Actions

The actions section is optional and fixed at the bottom, visible only when the expansion is in its
Copy link
Member

Choose a reason for hiding this comment

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

Actions may optionally be included at the bottom of the panel

@julianobrasil
Copy link
Contributor Author

Done.

@@ -0,0 +1,70 @@
<md-accordion class="example-headers-align">
<md-expansion-panel [expanded]="step === 0" (opened)="openEvent(0)" hideToggle="true">
Copy link
Contributor

Choose a reason for hiding this comment

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

Personally I think the toggles should be shown (instead of the icons) since this is the main example and you're trying to demo the features of the panel. If you insist on using icons,

  1. The color: blue is pretty harsh and could probably be dropped
  2. The icon-to-right thing cuts off the description text. Instead, unwrap the icons from their parent div, and make mat-expansion-panel-header-description justify-content with space-between and align-items center

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The icons are there just to show a situation where the the default is hidden (and to show that is possible to use some html inside the description). They are not really necessary. I can drop them. But before I'll try your suggestions to see how they look like.

Copy link
Contributor

Choose a reason for hiding this comment

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

Your html point is good... maybe wait for a team member before dropping? But yeah, I think the styles can be cleaned up a little anyway 😁

export class ExpansionStepsExample {
step = 0;

openEvent(stepNumb: number) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -0,0 +1,87 @@
`<md-expansion-panel>` provides a expandable details-summary view.
Copy link
Contributor

Choose a reason for hiding this comment

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

...an expandable...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@willshowell, done. Take a look.

Also, the example plunk: https://plnkr.co/edit/5q98WJ?p=preview

</md-input-container>

<md-input-container>
<input mdInput placeholder="Age">
Copy link
Contributor

Choose a reason for hiding this comment

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

type="number"?

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, thanks!

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Jul 25, 2017
@Component({
selector: 'expansion-overview-example',
templateUrl: 'expansion-overview-example.html',
})
Copy link
Contributor

Choose a reason for hiding this comment

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

@Component({
  selector: 'expansion-steps-example',
  templateUrl: 'expansion-steps-example.html',
  styleUrls: ['expansion-steps-example.css'],
})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the missing styleUrls

Copy link
Contributor

Choose a reason for hiding this comment

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

The template and selector need to change too! Looks like copy/paste from the other example

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The steps example was built over the overview one.

@andrewseguin andrewseguin merged commit 63411dc into angular:master Jul 27, 2017
@julianobrasil julianobrasil deleted the expansion-docs branch October 12, 2017 22:11
@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 7, 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.

Add docs for expansion-panel and accordion
8 participants