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

Commit c0bbad2

Browse files
committed
fix(layout): make [hide] attr work properly with all device sizes
1 parent a3ce7d8 commit c0bbad2

2 files changed

Lines changed: 26 additions & 14 deletions

File tree

docs/app/partials/layout-options.tmpl.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
<md-subheader hide-sm>
127127
I'm hidden on mobile and shown on larger devices.
128128
</md-subheader>
129-
<md-subheader hide show-sm>
129+
<md-subheader hide-gt-sm>
130130
I'm shown on mobile and hidden on larger devices.
131131
</md-subheader>
132132
</div>

src/core/style/layout.scss

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,55 +92,67 @@
9292
// ------------------------------
9393

9494
@include flex-properties-for-name();
95-
[hide]:not([show]):not([show-sm]):not([show-md]):not([show-lg]):not([show-gt-sm]):not([show-gt-md]):not([show-gt-lg]) {
95+
[hide]:not([show]) {
9696
display: none;
9797
}
9898

9999
@media (max-width: $layout-breakpoint-sm) {
100-
[hide-sm]:not([show-sm]) {
101-
display: none;
100+
[hide-sm], [hide] {
101+
&:not([show-sm]) {
102+
display: none;
103+
}
102104
}
103105

104106
@include layout-for-name(sm);
105107
@include flex-properties-for-name(sm);
106108
}
107109
@media (min-width: $layout-breakpoint-sm) {
108-
[hide-gt-sm]:not([show-gt-sm]):not([show-md]):not([show-gt-md]):not([show-lg]):not([show-gt-lg]) {
109-
display: none;
110+
[hide-gt-sm], [hide] {
111+
&:not([show-gt-sm]):not([show-md]):not([show-gt-md]):not([show-lg]):not([show-gt-lg]) {
112+
display: none;
113+
}
110114
}
111115

112116
@include layout-for-name(gt-sm);
113117
@include flex-properties-for-name(gt-sm);
114118
}
115119

116120
@media (min-width: $layout-breakpoint-sm) and (max-width: $layout-breakpoint-md) {
117-
[hide-md]:not([show-md]) {
118-
display: none;
121+
[hide-md], [hide] {
122+
&:not([show-md]) {
123+
display: none;
124+
}
119125
}
120126

121127
@include layout-for-name(md);
122128
@include flex-properties-for-name(md);
123129
}
124130
@media (min-width: $layout-breakpoint-md) {
125-
[hide-gt-md]:not([show-gt-md]):not([show-lg]):not([show-gt-lg]) {
126-
display: none;
131+
[hide-gt-md], [hide] {
132+
&:not([show-gt-md]):not([show-lg]):not([show-gt-lg]) {
133+
display: none;
134+
}
127135
}
128136

129137
@include layout-for-name(gt-md);
130138
@include flex-properties-for-name(gt-md);
131139
}
132140

133141
@media (min-width: $layout-breakpoint-md) and (max-width: $layout-breakpoint-lg) {
134-
[hide-lg]:not([show-lg]) {
135-
display: none;
142+
[hide-lg], [hide] {
143+
&:not([show-lg]) {
144+
display: none;
145+
}
136146
}
137147

138148
@include layout-for-name(lg);
139149
@include flex-properties-for-name(lg);
140150
}
141151
@media (min-width: $layout-breakpoint-lg) {
142-
[hide-gt-lg]:not([show-gt-lg]) {
143-
display: none;
152+
[hide-gt-lg], [hide] {
153+
&:not([show-gt-lg]) {
154+
display: none;
155+
}
144156
}
145157

146158
@include layout-for-name(gt-lg);

0 commit comments

Comments
 (0)