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

Fixed "Title jumps to the next line, out of the toolbar #508" #509

Merged
merged 11 commits into from
Apr 14, 2017
Merged
16 changes: 15 additions & 1 deletion packages/mdc-toolbar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,20 @@ of the toolbar (respectively).
```

Toolbar sections are laid out using flexbox. Each section will take up an equal
amount of space within the toolbar.
amount of space within the toolbar by default. But you can accommodate very long section (very long title) by adding `mdc-toolbar__section--shrink-to-fit` to other sections.

```
<div class="mdc-toolbar>
<div class="mdc-toolbar__row">
<section class="mdc-toolbar__section mdc-toolbar__section--align-start">
<span class="mdc-toolbar__title">This is a super super super super long title</span>
</section>
<section class="mdc-toolbar__section mdc-toolbar__section--align-end mdc-toolbar__section--shrink-to-fit">
<a class="material-icons search align-icons" aria-label="Search" alt="Search">search</a>
</section>
</div>
</div>
```

### Toolbar title

Expand Down Expand Up @@ -139,3 +152,4 @@ The provided modifiers are:
| `mdc-toolbar--fixed` | Make toolbar fixed to top of screen. |
| `mdc-toolbar__section--align-start` | Makes section aligns to the start. |
| `mdc-toolbar__section--align-end` | Makes section aligns to the end. |
| `mdc-toolbar__section--shrink-to-fit`| Makes section takes the width of its content.|
8 changes: 8 additions & 0 deletions packages/mdc-toolbar/mdc-toolbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ $mdc-toolbar-mobile-breakpoint: 599px;
align-items: flex-start;
justify-content: center;
z-index: 1;
overflow: hidden;

&--align-start {
justify-content: flex-start;
Expand All @@ -74,6 +75,9 @@ $mdc-toolbar-mobile-breakpoint: 599px;
&__title {
@include mdc-typography(title);

overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin: 0;
line-height: 1.5rem;
}
Expand All @@ -97,3 +101,7 @@ $mdc-toolbar-mobile-breakpoint: 599px;
margin-top: $mdc-toolbar-mobile-row-height;
}
}

.mdc-toolbar__section--shrink-to-fit {
flex: none;
}