-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for non-responsive values to
Grid
's gap
, columns
, a…
…nd `areas` props.
- Loading branch information
1 parent
8c1ee20
commit f7d6ed1
Showing
9 changed files
with
152 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@shopify/polaris': minor | ||
--- | ||
|
||
Added support for non-responsive values to `Grid`'s `gap`, `columns`, and `areas` props. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,24 @@ | ||
@import '../../styles/common'; | ||
|
||
.Grid { | ||
// Remap custom properties as mobile first fallbacks for grid-template-areas and grid-template-columns | ||
// stylelint-disable -- Polaris component custom properties | ||
--pc-grid-areas-xs: initial; | ||
--pc-grid-areas-sm: var(--pc-grid-areas-xs); | ||
--pc-grid-areas-md: var(--pc-grid-areas-sm); | ||
--pc-grid-areas-lg: var(--pc-grid-areas-md); | ||
--pc-grid-areas-xl: var(--pc-grid-areas-lg); | ||
--pc-grid-columns-xs: 6; | ||
--pc-grid-columns-sm: var(--pc-grid-columns-xs); | ||
--pc-grid-columns-md: var(--pc-grid-columns-sm); | ||
--pc-grid-columns-lg: 12; | ||
--pc-grid-columns-xl: var(--pc-grid-columns-lg); | ||
// stylelint-enable | ||
display: grid; | ||
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
gap: var(--pc-grid-gap-xs, var(--p-space-400)); | ||
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
grid-template-areas: var(--pc-grid-areas-xs); | ||
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
grid-template-columns: repeat(var(--pc-grid-columns-xs), minmax(0, 1fr)); | ||
|
||
@media #{$p-breakpoints-sm-up} { | ||
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
gap: var(--pc-grid-gap-sm, var(--p-space-400)); | ||
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
grid-template-areas: var(--pc-grid-areas-sm); | ||
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
grid-template-columns: repeat(var(--pc-grid-columns-sm), minmax(0, 1fr)); | ||
} | ||
|
||
@media #{$p-breakpoints-md-up} { | ||
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
gap: var(--pc-grid-gap-md, var(--p-space-400)); | ||
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
grid-template-areas: var(--pc-grid-areas-md); | ||
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
grid-template-columns: repeat(var(--pc-grid-columns-md), minmax(0, 1fr)); | ||
} | ||
|
||
@media #{$p-breakpoints-lg-up} { | ||
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
gap: var(--pc-grid-gap-lg, var(--p-space-400)); | ||
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
grid-template-areas: var(--pc-grid-areas-lg); | ||
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
grid-template-columns: repeat(var(--pc-grid-columns-lg), minmax(0, 1fr)); | ||
} | ||
|
||
@media #{$p-breakpoints-xl-up} { | ||
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
gap: var(--pc-grid-gap-xl, var(--p-space-400)); | ||
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
grid-template-areas: var(--pc-grid-areas-xl); | ||
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
grid-template-columns: repeat(var(--pc-grid-columns-xl), minmax(0, 1fr)); | ||
} | ||
@include responsive-props( | ||
'grid', | ||
'gap', | ||
'gap', | ||
$default: 'var(--p-space-400)' | ||
); | ||
@include responsive-props('grid', 'areas', 'grid-template-areas'); | ||
@include responsive-props( | ||
'grid', | ||
'columns', | ||
'--pc-grid-template-columns', | ||
$default: ('xs': 6, 'lg': 12) | ||
); | ||
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
grid-template-columns: repeat( | ||
var(--pc-grid-template-columns), | ||
minmax(0, 1fr) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 2 additions & 44 deletions
46
polaris-react/src/components/Grid/components/Cell/Cell.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.