Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 25dd787

Browse files
clshortfusekara
authored andcommitted
feat(button): add md-dense support (#9313)
1 parent 2bbf401 commit 25dd787

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

src/components/button/button.scss

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
$button-border-radius: 3px !default;
1+
// Material Design Button
2+
// https://material.google.com/components/buttons.html
3+
4+
$button-border-radius: 2px !default;
25
$button-fab-border-radius: 50% !default;
36
$button-icon-border-radius: $button-fab-border-radius !default;
47

8+
$button-font-size: $body-font-size-base !default;
9+
$button-font-size-dense: $body-font-size-base * 13/14 !default;
10+
511
$button-line-height: rem(3.60) !default;
12+
$button-line-height-dense: rem(3.20) !default;
613
$button-margin: rem(0.600) rem(0.800) !default;
714
$button-min-width: rem(8.800) !default;
815
$button-padding: 0 $button-left-right-padding !default;
@@ -31,9 +38,9 @@ button.md-button::-moz-focus-inner {
3138
cursor: pointer;
3239

3340
/** Alignment adjustments */
34-
min-height: $button-line-height;
41+
@include dense(min-height, $button-line-height, $button-line-height-dense);
3542
min-width: $button-min-width;
36-
line-height: $button-line-height;
43+
@include dense(line-height, $button-line-height, $button-line-height-dense);
3744

3845
vertical-align: middle;
3946
align-items: center;
@@ -58,7 +65,7 @@ button.md-button::-moz-focus-inner {
5865
/* Uppercase text content */
5966
text-transform: uppercase;
6067
font-weight: 500;
61-
font-size: $body-font-size-base;
68+
@include dense(font-size, $button-font-size, $button-font-size-dense);
6269
font-style: inherit;
6370
font-variant: inherit;
6471
font-family: inherit;

src/core/style/mixins.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,3 +321,19 @@
321321
}
322322
}
323323
}
324+
325+
@mixin dense($prop, $normal, $dense) {
326+
#{$prop}: $normal;
327+
.md-dense > &:not(.md-dense-disabled),
328+
.md-dense :not(.md-dense-disabled) &:not(.md-dense-disabled) {
329+
#{$prop}: $dense;
330+
}
331+
}
332+
333+
@mixin dense-rtl($prop, $ltr-normal, $rtl-normal, $ltr-dense, $rtl-dense) {
334+
@include rtl($prop, $ltr-normal, $rtl-normal);
335+
.md-dense > &:not(.md-dense-disabled),
336+
.md-dense :not(.md-dense-disabled) &:not(.md-dense-disabled) {
337+
@include rtl($prop, $ltr-dense, $rtl-dense);
338+
}
339+
}

0 commit comments

Comments
 (0)