Skip to content

Commit 557b100

Browse files
vdepizzolactions-userlangermank
authored
Add narrow/regular/wide viewport range utilities (#1995)
* Add viewport range utilities * Add comment about wide viewport range size * Stylelint auto-fixes * Create proud-donkeys-happen.md * Add support for `.show-whenRegular.hide-whenWide` As per discussion in https://github.com/primer/css/pull/1995/files#r834365336 Co-authored-by: Actions Auto Build <[email protected]> Co-authored-by: Katie Langerman <[email protected]>
1 parent 09f9d84 commit 557b100

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

.changeset/proud-donkeys-happen.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/css": patch
3+
---
4+
5+
Add narrow/regular/wide viewport range utilities

src/utilities/visibility-display.scss

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,55 @@
3838
}
3939
}
4040

41+
// Show/Hide Viewport range utilities
42+
43+
.show-whenNarrow,
44+
.show-whenRegular,
45+
.show-whenWide,
46+
.show-whenRegular.hide-whenWide {
47+
display: none !important;
48+
}
49+
50+
.hide-whenNarrow,
51+
.hide-whenRegular,
52+
.hide-whenWide {
53+
display: block !important;
54+
}
55+
56+
@media (max-width: $width-md - 0.02px) {
57+
.show-whenNarrow {
58+
display: block !important;
59+
}
60+
61+
.hide-whenNarrow {
62+
display: none !important;
63+
}
64+
}
65+
66+
@media (min-width: $width-md) {
67+
.show-whenRegular,
68+
.show-whenRegular.hide-whenWide {
69+
display: block !important;
70+
}
71+
72+
.hide-whenRegular {
73+
display: none !important;
74+
}
75+
}
76+
77+
// The width of a `wide` viewport range may change as we're finalizing
78+
// the Primer primitives viewport ranges proposal
79+
@media (min-width: $width-xl) {
80+
.show-whenWide {
81+
display: block !important;
82+
}
83+
84+
.hide-whenWide,
85+
.show-whenRegular.hide-whenWide {
86+
display: none !important;
87+
}
88+
}
89+
4190
/* Set the table-layout to fixed */
4291
.table-fixed { table-layout: fixed !important; }
4392

0 commit comments

Comments
 (0)