Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a13722e

Browse files
committedJul 22, 2020
fix(list): fix checkbox alignment and match dense heights to spec
- match the spec update where `md-dense` list items are `40px` in height by default - was `48px` in height - support `.md-dense-disabled` - for `.md-dense` lists: align heights with spec for list items with primary icons, avatars/avatar icons, secondary buttons, and checkboxes - `md-subheaders` in `.md-dense` lists should match the single line list item height - `48px` -> `40px` Fixes #11966 BREAKING CHANGE: `md-list` with the `md-dense` class has been updated to align with the Material Design specification. This means that `md-list-item`s heights have changed when using `md-dense`. The `md-dense-disabled` class is now supported on `md-list`. After updating to this version, you may need to adjust the layout of your app if you use `md-dense` with `md-list` or customize the layout of `md-checkbox`s within `md-list-item`s.
1 parent f2fca2e commit a13722e

File tree

3 files changed

+31
-14
lines changed

3 files changed

+31
-14
lines changed
 

‎src/components/button/button.scss

-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ $button-fab-mini-line-height: rem(4.00) !default;
2222

2323
$button-fab-toast-offset: $button-fab-height * 0.75 !default;
2424

25-
$icon-button-height: rem(4.000) !default;
26-
$icon-button-width: rem(4.000) !default;
2725
$icon-button-margin: rem(0.600) !default;
2826

2927
// Fix issue causing buttons in Firefox to be 2px bigger than they should

‎src/components/list/list.scss

+26-8
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ $list-item-height: 6 * $baseline-grid !default;
2828
$list-item-two-line-height: 9 * $baseline-grid !default;
2929
$list-item-three-line-height: 11 * $baseline-grid !default;
3030

31-
$list-item-dense-height: 12 * $dense-baseline-grid !default;
31+
$list-item-dense-height: 10 * $dense-baseline-grid !default;
3232
$list-item-dense-two-line-height: 15 * $dense-baseline-grid !default;
3333
$list-item-dense-three-line-height: 19 * $dense-baseline-grid !default;
3434
$list-item-dense-primary-icon-width: $dense-baseline-grid * 5 !default;
@@ -48,7 +48,7 @@ md-list {
4848
line-height: $list-header-line-height;
4949
}
5050

51-
&.md-dense {
51+
&.md-dense:not(.md-dense-disabled) {
5252
md-list-item {
5353
&,
5454
.md-list-item-inner {
@@ -65,15 +65,28 @@ md-list {
6565

6666
> md-icon:first-child:not(.md-avatar-icon) {
6767
@include rtl-prop(margin-right, margin-left, $list-item-primary-width - $list-item-dense-primary-icon-width, auto);
68+
margin-top: $dense-baseline-grid;
69+
margin-bottom: $dense-baseline-grid;
6870
}
6971
.md-avatar, .md-avatar-icon {
7072
@include rtl-prop(margin-right, margin-left, $list-item-primary-width - $list-item-dense-primary-avatar-width, auto);
73+
margin-top: $dense-baseline-grid + 2px;
74+
margin-bottom: $dense-baseline-grid + 2px;
7175
}
7276
.md-avatar {
7377
flex: none;
7478
width: $list-item-dense-primary-avatar-width;
7579
height: $list-item-dense-primary-avatar-width;
7680
}
81+
.md-secondary-container {
82+
.md-secondary.md-button {
83+
margin-top: $dense-baseline-grid;
84+
margin-bottom: $dense-baseline-grid;
85+
}
86+
md-checkbox:not(.md-dense-disabled) {
87+
min-height: $icon-button-height;
88+
}
89+
}
7790
}
7891

7992
&.md-2-line,
@@ -123,6 +136,10 @@ md-list {
123136
}
124137
}
125138
}
139+
.md-subheader-inner {
140+
padding-top: $dense-baseline-grid * 3;
141+
padding-bottom: $dense-baseline-grid * 3;
142+
}
126143
}
127144
}
128145

@@ -277,9 +294,9 @@ md-list-item {
277294

278295
& > md-checkbox {
279296
width: 3 * $baseline-grid;
280-
@include rtl(margin-left, 3px, 29px);
281-
@include rtl(margin-right, 29px, 3px);
282-
margin-top: 16px;
297+
min-height: $icon-button-height;
298+
@include rtl(margin-left, 0px, 29px);
299+
@include rtl(margin-right, 29px, 0px);
283300
}
284301

285302
.md-secondary-container {
@@ -311,11 +328,12 @@ md-list-item {
311328
}
312329

313330
md-checkbox {
314-
margin-top: 0;
315-
margin-bottom: 0;
331+
margin: 0 6px;
332+
padding: 0 8px;
333+
min-height: $icon-button-height;
316334

317335
&:last-child {
318-
width: 3 * $baseline-grid;
336+
width: $icon-button-width;
319337
@include rtl-prop(margin-right, margin-left, 0, auto);
320338
}
321339
}

‎src/core/style/_variables.scss

+5-4
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ $layout-breakpoint-sm: 960px !default;
3030
$layout-breakpoint-md: 1280px !default;
3131
$layout-breakpoint-lg: 1920px !default;
3232

33-
// Button
34-
$button-left-right-padding: rem(0.800) !default;
35-
3633
// Icon
3734
$icon-size: rem(2.400) !default;
3835

@@ -119,8 +116,12 @@ $material-leave-duration: 0.3s;
119116
$material-leave-timing-function: cubic-bezier(0.4, 0.0, 1, 1);
120117
$material-leave: all $material-leave-duration $material-leave-timing-function;
121118

119+
// Button
120+
$button-left-right-padding: rem(0.800) !default;
121+
$icon-button-height: rem(4.000) !default;
122+
$icon-button-width: rem(4.000) !default;
123+
122124
// Fab Buttons (shared between buttons.scss and fab*.scss)
123-
// -------------------------------------------
124125
$button-fab-width: rem(5.600) !default;
125126
$button-fab-height: rem(5.600) !default;
126127
$button-fab-padding: rem(1.60) !default;

0 commit comments

Comments
 (0)
Failed to load comments.