Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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/grumpy-zoos-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': patch
---

Add spacing around components in storybook, adjust grid if there is spacing
10 changes: 9 additions & 1 deletion polaris-react/.storybook/GridOverlay/GridOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@ interface Props {
maxWidth?: string;
layer?: Layer;
children?: React.ReactNode;
componentLayout: 'padded' | 'centered' | 'fullscreen';
}

export function GridOverlay({inFrame, maxWidth, layer, children}: Props) {
export function GridOverlay({
inFrame,
maxWidth,
layer,
children,
componentLayout,
}: Props) {
const [columns, setColumns] = useState(
window.innerWidth < BREAKPOINT ? COLUMNS_SMALL : COLUMNS_LARGE,
);
Expand All @@ -28,6 +35,7 @@ export function GridOverlay({inFrame, maxWidth, layer, children}: Props) {
const className = classNames('GridOverlay', inFrame && 'inFrame');
const style = {
maxWidth,
margin: componentLayout === 'padded' ? '0 1rem' : '',
zIndex: layer === 'above' || inFrame ? 1 : -1,
} as React.CSSProperties;

Expand Down
11 changes: 8 additions & 3 deletions polaris-react/.storybook/polaris-readme-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@ module.exports = function loader(source) {

const readme = parseCodeExamples(source);

const hasFullscreenLayout = ['App provider', 'Frame', 'Navigation'].includes(
readme.name,
);
const hasFullscreenLayout = [
'App provider',
'Frame',
'Fullscreen bar',
'Navigation',
'Sheet',
'Grid',
].includes(readme.name);

const omitAppProvider = [
'Frame',
Expand Down
5 changes: 0 additions & 5 deletions polaris-react/.storybook/preview-body.html

This file was deleted.

7 changes: 6 additions & 1 deletion polaris-react/.storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ function GridOverlayDecorator(Story, context) {
const {showGrid, gridInFrame, gridWidth, gridLayer} = context.globals;

const gridOverlay = showGrid ? (
<GridOverlay inFrame={gridInFrame} maxWidth={gridWidth} layer={gridLayer} />
<GridOverlay
inFrame={gridInFrame}
maxWidth={gridWidth}
layer={gridLayer}
componentLayout={context.parameters.layout}
/>
) : null;

return (
Expand Down