Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(subgrid): narrow mode margin #18255

Merged
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
4 changes: 2 additions & 2 deletions packages/grid/scss/_css-grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@

// Narrow
.#{$prefix}--css-grid--narrow {
--cds-grid-gutter-start: 0;
--cds-grid-gutter-start: 0rem; /* stylelint-disable-line length-zero-no-unit */
}

// Condensed
Expand Down Expand Up @@ -187,7 +187,7 @@
}

.#{$prefix}--subgrid--narrow {
--cds-grid-gutter-start: 0;
--cds-grid-gutter-start: 0rem; /* stylelint-disable-line length-zero-no-unit */
--cds-grid-gutter-end: #{math.div($grid-gutter, 2)};
--cds-grid-column-hang: #{math.div($grid-gutter, 2)};
}
Expand Down
134 changes: 91 additions & 43 deletions packages/react/src/components/Grid/Grid.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,49 +110,97 @@ export const Responsive = () => (

export const Subgrid = () => {
return (
<Grid>
<Column sm={2} md={4} lg={3}>
<p>Small: Span 2 of 4</p>
<p>Medium: Span 4 of 8</p>
<p>Large: Span 3 of 16</p>
</Column>
<Column sm={2} md={4} lg={10}>
<p>Small: Span 2 of 4</p>
<p>Medium: Span 4 of 8</p>
<p>Large: Span 10 of 16</p>
<Grid className="example">
<Column sm={1} md={1} lg={2}>
<p>sm={1}</p> <p>md={1}</p> <p>lg={2}</p>
</Column>
<Column sm={1} md={1} lg={2}>
<p>sm={1}</p> <p>md={1}</p> <p>lg={2}</p>
</Column>
<Column sm={0} md={1} lg={1}>
<p>sm={0}</p> <p>md={1}</p> <p>lg={1}</p>
</Column>
<Column sm={0} md={1} lg={1}>
<p>sm={0}</p> <p>md={1}</p> <p>lg={1}</p>
</Column>
<Column sm={0} md={0} lg={1}>
<p>sm={0}</p> <p>md={0}</p> <p>lg={1}</p>
</Column>
<Column sm={0} md={0} lg={1}>
<p>sm={0}</p> <p>md={0}</p> <p>lg={1}</p>
</Column>
<Column sm={0} md={0} lg={1}>
<p>sm={0}</p> <p>md={0}</p> <p>lg={1}</p>
</Column>
<Column sm={0} md={0} lg={1}>
<p>sm={0}</p> <p>md={0}</p> <p>lg={1}</p>
</Column>
</Grid>
</Column>
<Column sm={0} md={0} lg={3}>
<p>Small: Span 0 of 4</p>
<p>Medium: Span 0 of 8</p>
<p>Large: Span 3 of 16</p>
</Column>
</Grid>
<>
<Grid>
<Column sm={2} md={4} lg={3}>
<p>Small: Span 2 of 4</p>
<p>Medium: Span 4 of 8</p>
<p>Large: Span 3 of 16</p>
</Column>
<Column sm={2} md={4} lg={10}>
<p>Small: Span 2 of 4</p>
<p>Medium: Span 4 of 8</p>
<p>Large: Span 10 of 16</p>
<Grid className="example">
<Column sm={1} md={1} lg={2}>
<p>sm={1}</p> <p>md={1}</p> <p>lg={2}</p>
</Column>
<Column sm={1} md={1} lg={2}>
<p>sm={1}</p> <p>md={1}</p> <p>lg={2}</p>
</Column>
<Column sm={0} md={1} lg={1}>
<p>sm={0}</p> <p>md={1}</p> <p>lg={1}</p>
</Column>
<Column sm={0} md={1} lg={1}>
<p>sm={0}</p> <p>md={1}</p> <p>lg={1}</p>
</Column>
<Column sm={0} md={0} lg={1}>
<p>sm={0}</p> <p>md={0}</p> <p>lg={1}</p>
</Column>
<Column sm={0} md={0} lg={1}>
<p>sm={0}</p> <p>md={0}</p> <p>lg={1}</p>
</Column>
<Column sm={0} md={0} lg={1}>
<p>sm={0}</p> <p>md={0}</p> <p>lg={1}</p>
</Column>
<Column sm={0} md={0} lg={1}>
<p>sm={0}</p> <p>md={0}</p> <p>lg={1}</p>
</Column>
</Grid>
</Column>
<Column sm={0} md={0} lg={3}>
<p>Small: Span 0 of 4</p>
<p>Medium: Span 0 of 8</p>
<p>Large: Span 3 of 16</p>
</Column>
</Grid>

<h5>Wide</h5>
<Grid>
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={8} lg={16}>
<Grid>
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={4} lg={4} />
</Grid>
</Column>
</Grid>
<h5>Narrow</h5>
<Grid narrow>
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={8} lg={16}>
<Grid narrow>
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={4} lg={4} />
</Grid>
</Column>
</Grid>
<h5>Condensed</h5>
<Grid condensed>
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={8} lg={16}>
<Grid condensed>
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={4} lg={4} />
<Column sm={4} md={4} lg={4} />
</Grid>
</Column>
</Grid>
</>
);
};

Expand Down
Loading