Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### WHY are these changes introduced? Resolves #10617. ### WHAT is this pull request doing? Adds: - support for `paddingInline` and `paddingBlock` to reduce the need to set the value redundantly with multiple props - updates to `Box` padding documentation on style guide and storybook - fixes the text color on layout component style guide examples for accessibility <details> <summary>Box padding documentation — before</summary> <img src="https://github.com/Shopify/polaris/assets/26749317/a1e91acb-c9fc-4783-8365-a2ebc48a2fd7" alt="Box padding documentation — before"> </details> <details> <summary>Box padding documentation — after</summary> <img src="https://github.com/Shopify/polaris/assets/26749317/950a7fd0-ced5-41a4-b3e9-a9aea7c89506" alt="Box padding documentation — after"> </details> ### How to 🎩 Example that tests different use cases for Box padding props in the Playground included below. 🖥 [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) <details> <summary>Copy-paste this code in <code>playground/Playground.tsx</code>:</summary> ```jsx import React from 'react'; import {Page, Box, BlockStack, Text} from '../src'; export function Playground() { return ( <Page title="Playground"> {/* Add the code you want to test in here */} <BlockStack gap="800"> <BlockStack gap="200"> <Text as="h1" variant="headingLg"> Box padding — default </Text> <Box background="bg-surface" borderWidth="025" borderColor="border"> <Text as="p" variant="bodyMd" truncate> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent aliquet libero et metus tempus, sit amet malesuada justo posuere. Nulla egestas, diam et dapibus maximus, nisl neque tempus sapien, semper tincidunt nulla elit vitae dui. Nulla scelerisque porta ex at mattis. Phasellus tempor augue nec eros egestas laoreet. </Text> </Box> </BlockStack> <BlockStack gap="200"> <Text as="h1" variant="headingLg"> Box padding — paddingBlock only </Text> <Box background="bg-fill-magic-secondary" paddingBlock="2400" borderWidth="025" borderColor="border" > <Text as="p" variant="bodyMd" truncate> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent aliquet libero et metus tempus, sit amet malesuada justo posuere. Nulla egestas, diam et dapibus maximus, nisl neque tempus sapien, semper tincidunt nulla elit vitae dui. Nulla scelerisque porta ex at mattis. Phasellus tempor augue nec eros egestas laoreet. </Text> </Box> </BlockStack> <BlockStack gap="200"> <Text as="h1" variant="headingLg"> Box padding — paddingBlock responsive (xs and lg breakpoint) </Text> <Box background="bg-fill-magic-secondary" paddingBlock={{xs: '0', lg: '2400'}} borderWidth="025" borderColor="border" > <Text as="p" variant="bodyMd" truncate> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent aliquet libero et metus tempus, sit amet malesuada justo posuere. Nulla egestas, diam et dapibus maximus, nisl neque tempus sapien, semper tincidunt nulla elit vitae dui. Nulla scelerisque porta ex at mattis. Phasellus tempor augue nec eros egestas laoreet. </Text> </Box> </BlockStack> <BlockStack gap="200"> <Text as="h1" variant="headingLg"> Box padding — paddingBlock and paddingBlockStart (different values) </Text> <Box background="bg-fill-magic-secondary" paddingBlock="2400" paddingBlockEnd="800" borderWidth="025" borderColor="border" > <Text as="p" variant="bodyMd" truncate> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent aliquet libero et metus tempus, sit amet malesuada justo posuere. Nulla egestas, diam et dapibus maximus, nisl neque tempus sapien, semper tincidunt nulla elit vitae dui. Nulla scelerisque porta ex at mattis. Phasellus tempor augue nec eros egestas laoreet. </Text> </Box> </BlockStack> <BlockStack gap="200"> <Text as="h1" variant="headingLg"> Box padding — paddingInline only </Text> <Box background="bg-fill-warning-secondary" paddingInline="3200" borderWidth="025" borderColor="border" > <Text as="p" variant="bodyMd" truncate> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent aliquet libero et metus tempus, sit amet malesuada justo posuere. Nulla egestas, diam et dapibus maximus, nisl neque tempus sapien, semper tincidunt nulla elit vitae dui. Nulla scelerisque porta ex at mattis. Phasellus tempor augue nec eros egestas laoreet. </Text> </Box> </BlockStack> <BlockStack gap="200"> <Text as="h1" variant="headingLg"> Box padding — paddingInline responsive (xs and lg breakpoint) </Text> <Box background="bg-fill-warning-secondary" paddingInline={{xs: '0', lg: '3200'}} borderWidth="025" borderColor="border" > <Text as="p" variant="bodyMd" truncate> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent aliquet libero et metus tempus, sit amet malesuada justo posuere. Nulla egestas, diam et dapibus maximus, nisl neque tempus sapien, semper tincidunt nulla elit vitae dui. Nulla scelerisque porta ex at mattis. Phasellus tempor augue nec eros egestas laoreet. </Text> </Box> </BlockStack> <BlockStack gap="200"> <Text as="h1" variant="headingLg"> Box padding — paddingInline and paddingInlineEnd (different values) </Text> <Box background="bg-fill-warning-secondary" paddingInline="3200" paddingInlineEnd="800" borderWidth="025" borderColor="border" > <Text as="p" variant="bodyMd" truncate> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent aliquet libero et metus tempus, sit amet malesuada justo posuere. Nulla egestas, diam et dapibus maximus, nisl neque tempus sapien, semper tincidunt nulla elit vitae dui. Nulla scelerisque porta ex at mattis. Phasellus tempor augue nec eros egestas laoreet. </Text> </Box> </BlockStack> <BlockStack gap="200"> <Text as="h1" variant="headingLg"> Box padding — padding only </Text> <Box background="bg-surface-success" padding="500" borderWidth="025" borderColor="border" > <Text as="p" variant="bodyMd" truncate> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent aliquet libero et metus tempus, sit amet malesuada justo posuere. Nulla egestas, diam et dapibus maximus, nisl neque tempus sapien, semper tincidunt nulla elit vitae dui. Nulla scelerisque porta ex at mattis. Phasellus tempor augue nec eros egestas laoreet. </Text> </Box> </BlockStack> <BlockStack gap="200"> <Text as="h1" variant="headingLg"> Box padding — padding responsive (xs and lg breakpoint) </Text> <Box background="bg-surface-success" padding={{xs: '0', lg: '500'}} borderWidth="025" borderColor="border" > <Text as="p" variant="bodyMd" truncate> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent aliquet libero et metus tempus, sit amet malesuada justo posuere. Nulla egestas, diam et dapibus maximus, nisl neque tempus sapien, semper tincidunt nulla elit vitae dui. Nulla scelerisque porta ex at mattis. Phasellus tempor augue nec eros egestas laoreet. </Text> </Box> </BlockStack> <BlockStack gap="200"> <Text as="h1" variant="headingLg"> Box padding — paddingInlineStart, paddingInlineEnd, paddingBlockStart, paddingBlockEnd (different values) </Text> <Box background="bg-fill-critical-secondary" paddingInlineStart="200" paddingInlineEnd="400" paddingBlockStart="600" paddingBlockEnd="800" borderWidth="025" borderColor="border" > <Text as="p" variant="bodyMd" truncate> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent aliquet libero et metus tempus, sit amet malesuada justo posuere. Nulla egestas, diam et dapibus maximus, nisl neque tempus sapien, semper tincidunt nulla elit vitae dui. Nulla scelerisque porta ex at mattis. Phasellus tempor augue nec eros egestas laoreet. </Text> </Box> </BlockStack> <BlockStack gap="200"> <Text as="h1" variant="headingLg"> Box padding — paddingInlineStart, paddingInlineEnd, paddingBlockStart, paddingBlockEnd responsive (xs and lg breakpoint) </Text> <Box background="bg-fill-critical-secondary" paddingInlineStart={{xs: '0', lg: '200'}} paddingInlineEnd={{xs: '0', lg: '400'}} paddingBlockStart={{xs: '0', lg: '600'}} paddingBlockEnd={{xs: '0', lg: '800'}} borderWidth="025" borderColor="border" > <Text as="p" variant="bodyMd" truncate> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent aliquet libero et metus tempus, sit amet malesuada justo posuere. Nulla egestas, diam et dapibus maximus, nisl neque tempus sapien, semper tincidunt nulla elit vitae dui. Nulla scelerisque porta ex at mattis. Phasellus tempor augue nec eros egestas laoreet. </Text> </Box> </BlockStack> </BlockStack> </Page> ); } ``` </details> ### 🎩 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