Skip to content
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/wild-seas-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'polaris.shopify.com': patch
---

Updated `Bleed` component guidance and examples
14 changes: 9 additions & 5 deletions polaris.shopify.com/content/components/bleed.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Bleed
description: Used to create a container that applies negative margins to allow content to extend into the surrounding layout.
description: Applies negative margin to allow content to bleed out into the surrounding layout.
category: Structure
keywords:
- layout
Expand All @@ -11,17 +11,21 @@ examples:
- fileName: bleed-vertical.tsx
title: Vertical
description: >-
Use to set bleed vertically.
Content will bleed vertically into the surrounding layout using the vertical prop.
- fileName: bleed-horizontal.tsx
title: Horizontal
description: >-
Use to set bleed horizontally.
Content will bleed horizontally into the surrounding layout using the horizontal prop.
- fileName: bleed-specific-direction.tsx
title: Specific direction
description: >-
Use to set bleed in a specific direction
Content will bleed into the surrounding layout in a specific direction using the top, bottom, left, or right prop.
- fileName: bleed-all-directions.tsx
title: All directions
description: >-
Use to set bleed in all directions
Content will bleed into the surrounding layout in all directions using the spacing prop.
---

## Bleed values

Content should never go beyond the edges of the parent container. Choose a bleed value that works within the containing layout.
52 changes: 31 additions & 21 deletions polaris.shopify.com/pages/examples/bleed-all-directions.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,41 @@
import React from 'react';
import {Bleed, Box, Text} from '@shopify/polaris';
import {Bleed, Box, Text, Inline} from '@shopify/polaris';

import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';

const styles = {
background: 'var(--p-background-selected)',
borderRadius: 'var(--p-border-radius-05)',
border: '1px solid var(--p-surface-dark)',
padding: 'var(--p-space-4)',
height: 'var(--p-space-12)',
opacity: 0.7,
};

function BleedAllDirectionsExample() {
return (
<div style={{width: '100%'}}>
<Box background="surface" border="base" padding="4">
<Bleed spacing="6">
<div style={styles}>
<Text variant="bodySm" as="h3" alignment="center" fontWeight="bold">
All directions
</Text>
</div>
</Bleed>
</Box>
</div>
<Box background="surface" border="base" padding="4">
<Bleed spacing="4">
<Placeholder label="All directions" />
</Bleed>
</Box>
);
}

const Placeholder = ({label = '', height = 'auto', width = 'auto'}) => {
return (
<div
style={{
background: '#7B47F1',
padding: '14px var(--p-space-2)',
height: height,
width: width,
}}
>
<Inline align="center">
<div
style={{
color: '#FFFFFF',
}}
>
<Text as="h2" variant="bodyMd" fontWeight="regular">
{label}
</Text>
</div>
</Inline>
</div>
);
};

export default withPolarisExample(BleedAllDirectionsExample);
52 changes: 31 additions & 21 deletions polaris.shopify.com/pages/examples/bleed-horizontal.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,41 @@
import React from 'react';
import {Bleed, Box, Text} from '@shopify/polaris';
import {Bleed, Box, Text, Inline} from '@shopify/polaris';

import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';

const styles = {
background: 'var(--p-background-selected)',
borderRadius: 'var(--p-border-radius-05)',
border: '1px solid var(--p-surface-dark)',
padding: 'var(--p-space-4)',
height: 'var(--p-space-12)',
opacity: 0.7,
};

function BleedHorizontalExample() {
return (
<div style={{width: '100%'}}>
<Box background="surface" border="base" padding="4">
<Bleed horizontal="6">
<div style={styles}>
<Text variant="bodySm" as="h3" alignment="center" fontWeight="bold">
horizontal
</Text>
</div>
</Bleed>
</Box>
</div>
<Box background="surface" border="base" padding="4">
<Bleed horizontal="4">
<Placeholder label="Horizontal" />
</Bleed>
</Box>
);
}

const Placeholder = ({label = '', height = 'auto', width = 'auto'}) => {
return (
<div
style={{
background: '#7B47F1',
padding: '14px var(--p-space-2)',
height: height,
width: width,
}}
>
<Inline align="center">
<div
style={{
color: '#FFFFFF',
}}
>
<Text as="h2" variant="bodyMd" fontWeight="regular">
{label}
</Text>
</div>
</Inline>
</div>
);
};

export default withPolarisExample(BleedHorizontalExample);
76 changes: 36 additions & 40 deletions polaris.shopify.com/pages/examples/bleed-specific-direction.tsx
Original file line number Diff line number Diff line change
@@ -1,62 +1,58 @@
import React from 'react';
import {Bleed, Box, Text} from '@shopify/polaris';
import {AlphaStack, Bleed, Box, Text, Inline} from '@shopify/polaris';

import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';

const styles = {
background: 'var(--p-background-selected)',
borderRadius: 'var(--p-border-radius-05)',
border: '1px solid var(--p-surface-dark)',
padding: 'var(--p-space-4)',
height: 'var(--p-space-12)',
opacity: 0.7,
};

function BleedSpecificDirectionExample() {
return (
<div style={{width: '100%'}}>
<AlphaStack spacing="6" fullWidth>
<Box background="surface" border="base" padding="4">
<Bleed top="6">
<div style={styles}>
<Text variant="bodySm" as="h3" alignment="center" fontWeight="bold">
top
</Text>
</div>
<Bleed top="4">
<Placeholder label="Top" />
</Bleed>
</Box>
<br />
<Box background="surface" border="base" padding="4">
<Bleed right="6">
<div style={styles}>
<Text variant="bodySm" as="h3" alignment="center" fontWeight="bold">
right
</Text>
</div>
<Bleed bottom="4">
<Placeholder label="Bottom" />
</Bleed>
</Box>
<br />
<Box background="surface" border="base" padding="4">
<Bleed left="6">
<div style={styles}>
<Text variant="bodySm" as="h3" alignment="center" fontWeight="bold">
left
</Text>
</div>
<Bleed left="4">
<Placeholder label="Left" />
</Bleed>
</Box>
<br />
<Box background="surface" border="base" padding="4">
<Bleed bottom="6">
<div style={styles}>
<Text variant="bodySm" as="h3" alignment="center" fontWeight="bold">
bottom
</Text>
</div>
<Bleed right="4">
<Placeholder label="Right" />
</Bleed>
</Box>
<br />
</div>
</AlphaStack>
);
}

const Placeholder = ({label = '', height = 'auto', width = 'auto'}) => {
return (
<div
style={{
background: '#7B47F1',
padding: '14px var(--p-space-2)',
height: height,
width: width,
}}
>
<Inline align="center">
<div
style={{
color: '#FFFFFF',
}}
>
<Text as="h2" variant="bodyMd" fontWeight="regular">
{label}
</Text>
</div>
</Inline>
</div>
);
};

export default withPolarisExample(BleedSpecificDirectionExample);
52 changes: 31 additions & 21 deletions polaris.shopify.com/pages/examples/bleed-vertical.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,41 @@
import React from 'react';
import {Bleed, Box, Text} from '@shopify/polaris';
import {Bleed, Box, Text, Inline} from '@shopify/polaris';

import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';

const styles = {
background: 'var(--p-background-selected)',
borderRadius: 'var(--p-border-radius-05)',
border: '1px solid var(--p-surface-dark)',
padding: 'var(--p-space-4)',
height: 'var(--p-space-12)',
opacity: 0.7,
};

function BleedVerticalExample() {
return (
<div style={{width: '100%'}}>
<Box background="surface" border="base" padding="4">
<Bleed vertical="6">
<div style={styles}>
<Text variant="bodySm" as="h3" alignment="center" fontWeight="bold">
vertical
</Text>
</div>
</Bleed>
</Box>
</div>
<Box background="surface" border="base" padding="4">
<Bleed vertical="4">
<Placeholder label="Vertical" />
</Bleed>
</Box>
);
}

const Placeholder = ({label = '', height = 'auto', width = 'auto'}) => {
return (
<div
style={{
background: '#7B47F1',
padding: '14px var(--p-space-2)',
height: height,
width: width,
}}
>
<Inline align="center">
<div
style={{
color: '#FFFFFF',
}}
>
<Text as="h2" variant="bodyMd" fontWeight="regular">
{label}
</Text>
</div>
</Inline>
</div>
);
};

export default withPolarisExample(BleedVerticalExample);