Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/blue-hotels-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': patch
---

Added horizontal spacing defaults to `Bleed`
2 changes: 1 addition & 1 deletion polaris-react/src/components/AlphaCard/AlphaCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const AlphaCard = ({
background={background}
padding={padding}
shadow="card"
{...(hasBorderRadius && {borderRadius: defaultBorderRadius})}
borderRadius={hasBorderRadius ? defaultBorderRadius : undefined}
>
{children}
</Box>
Expand Down
16 changes: 12 additions & 4 deletions polaris-react/src/components/Bleed/Bleed.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import type {ComponentMeta} from '@storybook/react';
import {Bleed, Box} from '@shopify/polaris';
import {AlphaCard, Bleed, Box, Text} from '@shopify/polaris';

export default {
component: Bleed,
Expand All @@ -15,11 +15,19 @@ const styles = {

export function Default() {
return (
<Box background="surface" padding="4">
<AlphaCard>
<Text as="p" variant="bodySm">
Section 01
</Text>
<Bleed>
<div style={styles} />
<Box paddingBlockStart="2" paddingBlockEnd="2">
<Box borderBlockStart="base" />
</Box>
</Bleed>
</Box>
<Text as="p" variant="bodySm">
Section 02
</Text>
</AlphaCard>
);
}

Expand Down
6 changes: 4 additions & 2 deletions polaris-react/src/components/Bleed/Bleed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export interface BleedProps {
children: React.ReactNode;
/** Negative space around the element */
spacing?: SpacingSpaceScale;
/** Negative horizontal space around the element */
/** Negative horizontal space around the element
* * @default '5'
*/
horizontal?: SpacingSpaceScale;
/** Negative vertical space around the element */
vertical?: SpacingSpaceScale;
Expand All @@ -26,7 +28,7 @@ export interface BleedProps {

export const Bleed = ({
spacing,
horizontal,
horizontal = '5',
vertical,
top,
bottom,
Expand Down
10 changes: 8 additions & 2 deletions polaris-react/src/components/Bleed/tests/Bleed.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ describe('<Bleed />', () => {
expect(bleed).toContainReactComponent(Children);
});

it('does not render custom properties by default', () => {
it('renders default horizontal custom properties', () => {
const bleed = mountWithApp(
<Bleed>
<Children />
</Bleed>,
);

expect(bleed).toContainReactComponent('div', {style: undefined});
expect(bleed).toContainReactComponent('div', {
style: {
'--pc-bleed-margin-left': 'var(--p-space-5)',
'--pc-bleed-margin-right': 'var(--p-space-5)',
} as React.CSSProperties,
});
});

it('only renders the custom property that matches the property passed in', () => {
Expand All @@ -36,6 +41,7 @@ describe('<Bleed />', () => {
expect(bleed).toContainReactComponent('div', {
style: {
'--pc-bleed-margin-left': 'var(--p-space-2)',
'--pc-bleed-margin-right': 'var(--p-space-5)',
} as React.CSSProperties,
});
});
Expand Down