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

Commit b6edf55

Browse files
clshortfuseThomasBurleson
authored andcommitted
feat(layouts): add @mixin for responsive support for rows
Create @mixin that allows different layout breakpoints Fixes #9112 Closes #9115
1 parent 46662d3 commit b6edf55

File tree

4 files changed

+65
-51
lines changed

4 files changed

+65
-51
lines changed
Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
11
md-divider.md-THEME_NAME-theme {
2-
border-top-color: '{{foreground-4}}';
3-
}
4-
5-
.layout-row,
6-
.layout-xs-row, .layout-gt-xs-row,
7-
.layout-sm-row, .layout-gt-sm-row,
8-
.layout-md-row, .layout-gt-md-row,
9-
.layout-lg-row, .layout-gt-lg-row,
10-
.layout-xl-row {
11-
& > md-divider.md-THEME_NAME-theme {
12-
border-right-color: '{{foreground-4}}';
13-
}
2+
border-color: '{{foreground-4}}';
143
}

src/components/divider/divider.scss

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,8 @@ md-divider {
99
}
1010
}
1111

12-
.layout-row,
13-
.layout-xs-row, .layout-gt-xs-row,
14-
.layout-sm-row, .layout-gt-sm-row,
15-
.layout-md-row, .layout-gt-md-row,
16-
.layout-lg-row, .layout-gt-lg-row,
17-
.layout-xl-row {
18-
& > md-divider {
19-
border-top-width: 0;
20-
border-right-width: 1px;
21-
border-right-style: solid;
22-
}
12+
@include when-layout-row(md-divider) {
13+
border-top-width: 0;
14+
border-right-width: 1px;
15+
border-right-style: solid;
2316
}

src/components/radioButton/radio-button.scss

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -113,36 +113,12 @@ md-radio-button {
113113
}
114114
}
115115

116-
md-radio-group {
117-
/** Layout adjustments for the radio group. */
118-
&.layout-column,
119-
&.layout-xs-column, &.layout-gt-xs-column,
120-
&.layout-sm-column, &.layout-gt-sm-column,
121-
&.layout-md-column, &.layout-gt-md-column,
122-
&.layout-lg-column, &.layout-gt-lg-column,
123-
&.layout-xl-column {
124-
md-radio-button {
125-
margin-bottom: $radio-margin;
126-
}
127-
}
128116

129-
&.layout-row,
130-
&.layout-xs-row, &.layout-gt-xs-row,
131-
&.layout-sm-row, &.layout-gt-sm-row,
132-
&.layout-md-row, &.layout-gt-md-row,
133-
&.layout-lg-row, &.layout-gt-lg-row,
134-
&.layout-xl-row {
135-
md-radio-button {
136-
margin-top: 0;
137-
margin-bottom: 0;
138-
@include rtl(margin-left, 0, $radio-margin);
139-
@include rtl(margin-right, $radio-margin, 0);
140117

141-
&:last-of-type {
142-
margin-left: 0;
143-
margin-right: 0;
144-
}
145-
}
118+
md-radio-group {
119+
/** Layout adjustments for the radio group. */
120+
md-radio-button {
121+
margin-bottom: $radio-margin;
146122
}
147123

148124
&:focus {
@@ -163,6 +139,18 @@ md-radio-group {
163139
}
164140
}
165141

142+
@include when-layout-row(md-radio-button, md-radio-group) {
143+
margin-top: 0;
144+
margin-bottom: 0;
145+
@include rtl(margin-left, 0, $radio-margin);
146+
@include rtl(margin-right, $radio-margin, 0);
147+
148+
&:last-of-type {
149+
margin-left: 0;
150+
margin-right: 0;
151+
}
152+
}
153+
166154
.md-inline-form {
167155
md-radio-group {
168156
margin: 18px 0 19px;

src/core/style/mixins.scss

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,3 +326,47 @@
326326
}
327327
}
328328
}
329+
330+
// Only use when in row layout
331+
@mixin when-layout-row($element, $parent: '') {
332+
@media (max-width: 599px) {
333+
#{$parent}.layout-row:not(.layout-xs-column),
334+
#{$parent}.layout-xs-row {
335+
& > #{$element} { @content; }
336+
}
337+
}
338+
@media (min-width: 600px) and (max-width: 959px) {
339+
#{$parent}.layout-row:not(.layout-gt-xs-column),
340+
#{$parent}.layout-gt-xs-row,
341+
#{$parent}.layout-sm-row {
342+
&:not(.layout-sm-column) > #{$element} { @content; }
343+
}
344+
}
345+
@media (min-width: 960px) and (max-width: 1279px) {
346+
#{$parent}.layout-row:not(.layout-gt-xs-column):not(.layout-gt-sm-column),
347+
#{$parent}.layout-gt-xs-row:not(.layout-gt-sm-column),
348+
#{$parent}.layout-gt-sm-row,
349+
#{$parent}.layout-md-row {
350+
&:not(.layout-md-column) > #{$element} { @content; }
351+
}
352+
}
353+
@media (min-width: 1280px) and (max-width: 1919px) {
354+
#{$parent}.layout-row:not(.layout-gt-xs-column):not(.layout-gt-sm-column):not(.layout-gt-md-column),
355+
#{$parent}.layout-gt-xs-row:not(.layout-gt-sm-column):not(.layout-gt-md-column),
356+
#{$parent}.layout-gt-sm-row:not(.layout-gt-md-column),
357+
#{$parent}.layout-gt-md-row,
358+
#{$parent}.layout-lg-row {
359+
&:not(.layout-lg-column) > #{$element} { @content; }
360+
}
361+
}
362+
@media (min-width: 1920px) {
363+
#{$parent}.layout-row:not(.layout-gt-xs-column):not(.layout-gt-sm-column):not(.layout-gt-md-column),
364+
#{$parent}.layout-gt-xs-row:not(.layout-gt-sm-column):not(.layout-gt-md-column),
365+
#{$parent}.layout-gt-sm-row:not(.layout-gt-md-column),
366+
#{$parent}.layout-gt-md-row,
367+
#{$parent}.layout-gt-lg-row,
368+
#{$parent}.layout-xl-row {
369+
&:not(.layout-gt-lg-column):not(.layout-xl-column) > #{$element} { @content; }
370+
}
371+
}
372+
}

0 commit comments

Comments
 (0)