Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Columns] Refactor gap to use
getResponsiveProps
util (#7761)
### WHY are these changes introduced? Resolves #7749. Refactors the `Columns` `gap` prop to use the `getResponsiveProps` util. Also refactors `gap` so that it accepts a single string value or an object with different values at varying breakpoints. <!-- Context about the problem that’s being addressed. --> ### WHAT is this pull request doing? Updates `Columns` to use `getResponsiveProps` util. Also updates tests, storybook examples, and the style guide. <!-- ℹ️ Delete the following for small / trivial changes --> ### How to 🎩 **[Storybook](https://5d559397bae39100201eedc1-egzpnipkkn.chromatic.com/?path=/story/all-components-columns--default).** 🖥 [Local development instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development) 🗒 [General tophatting guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md) 📄 [Changelog guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog) ### 🎩 checklist - [x] Tested on [mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing) - [x] Tested on [multiple browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers) - [ ] Tested for [accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md) - [ ] Updated the component's `README.md` with documentation changes - [x] [Tophatted documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md) changes in the style guide
- Loading branch information
Showing
6 changed files
with
1,378 additions
and
1,357 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,6 @@ | ||
--- | ||
'@shopify/polaris': patch | ||
'polaris.shopify.com': patch | ||
--- | ||
|
||
Refactored `Columns` `gap` to use `getResponsiveProps` util |
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,37 +1,29 @@ | ||
@import '../../styles/common'; | ||
|
||
.Columns { | ||
@include responsive-props('columns', 'gap', 'gap'); | ||
|
||
--pc-columns-xs: 6; | ||
--pc-columns-sm: var(--pc-columns-xs); | ||
--pc-columns-md: var(--pc-columns-sm); | ||
--pc-columns-lg: var(--pc-columns-md); | ||
--pc-columns-xl: var(--pc-columns-lg); | ||
--pc-columns-gap-xs: var(--p-space-4); | ||
--pc-columns-gap-sm: var(--pc-columns-gap-xs); | ||
--pc-columns-gap-md: var(--pc-columns-gap-sm); | ||
--pc-columns-gap-lg: var(--pc-columns-gap-md); | ||
--pc-columns-gap-xl: var(--pc-columns-gap-lg); | ||
display: grid; | ||
gap: var(--pc-columns-gap-xs); | ||
grid-template-columns: var(--pc-columns-xs); | ||
|
||
@media #{$p-breakpoints-sm-up} { | ||
gap: var(--pc-columns-gap-sm); | ||
grid-template-columns: var(--pc-columns-sm); | ||
} | ||
|
||
@media #{$p-breakpoints-md-up} { | ||
gap: var(--pc-columns-gap-md); | ||
grid-template-columns: var(--pc-columns-md); | ||
} | ||
|
||
@media #{$p-breakpoints-lg-up} { | ||
gap: var(--pc-columns-gap-lg); | ||
grid-template-columns: var(--pc-columns-lg); | ||
} | ||
|
||
@media #{$p-breakpoints-xl-up} { | ||
gap: var(--pc-columns-gap-xl); | ||
grid-template-columns: var(--pc-columns-xl); | ||
} | ||
} |
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.