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

bug(md-slide-toggle): slide toggle should fit to it's content width #3231

Merged
merged 6 commits into from
Mar 13, 2017
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/demo-app/slide-toggle/slide-toggle-demo.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div>
<div class="slide-toggle-example">

<md-slide-toggle color="primary" [(ngModel)]="firstToggle">
Default Slide Toggle
Expand Down
8 changes: 8 additions & 0 deletions src/demo-app/slide-toggle/slide-toggle-demo.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.slide-toggle-example {
display:flex;
Copy link
Member

Choose a reason for hiding this comment

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

Space between the property and value please.

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

Copy link
Member

Choose a reason for hiding this comment

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

Cool thx. Why still using align-items?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to show that the slide toggle now has a display inline-block. If I do not use it, the browser will stretch the line and you can still click on the whole line to check the slide toggle.

Example

Copy link
Member

Choose a reason for hiding this comment

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

Thanks. Yeah I already tested it locally. Looks good!

flex-direction: column;
flex-wrap: wrap;
justify-content: flex-start;
align-content: flex-start;
align-items: flex-start;
Copy link
Member

Choose a reason for hiding this comment

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

Only doing the following is enough:

display: flex;
flex-direction: column;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@devversion although just these properties set each slide toggle on it's own row, I kept the property align-items: flex-start; so the demo will not stretch the lines

}
2 changes: 1 addition & 1 deletion src/lib/slide-toggle/slide-toggle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $mat-slide-toggle-bar-track-width: $mat-slide-toggle-bar-width - $mat-slide-togg


.mat-slide-toggle {
display: flex;
display: inline-block;
height: $mat-slide-toggle-height;

margin: $mat-slide-toggle-margin 0;
Expand Down