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

feat!: Allow zero row gap for Grid #1040

Merged
merged 3 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 5 additions & 1 deletion packages/css/src/components/grid/grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
--amsterdam-grid-gap: var(--amsterdam-grid-spacious-gap);
--amsterdam-grid-padding-inline: var(--amsterdam-grid-spacious-padding-inline);

column-gap: var(--amsterdam-grid-gap);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This removes the row gap by default, which is not what we want. We rely on the vertical gap being the same as the horizontal one by default, e.g. when moving cells around respponsively and in grids of cards or top task buttons.

display: grid;
gap: var(--amsterdam-grid-gap);
grid-template-columns: repeat(var(--amsterdam-grid-column-count), 1fr);
padding-inline: var(--amsterdam-grid-padding-inline);

Expand All @@ -32,6 +32,10 @@
row-gap: calc(var(--amsterdam-grid-gap) / 2);
}

.amsterdam-grid--gap-vertical--medium {
row-gap: var(--amsterdam-grid-gap);
}

.amsterdam-grid--gap-vertical--large {
row-gap: calc(var(--amsterdam-grid-gap) * 2);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/Grid/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export type GridProps = {
*/
compact?: boolean
/** The amount of vertical whitespace between rows of the grid. */
gapVertical?: 'small' | 'large'
gapVertical?: 'small' | 'medium' | 'large'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think medium should be the default, and this prop should accept a none value.

} & (GridPaddingVerticalProp | GridPaddingTopAndBottomProps) &
PropsWithChildren<HTMLAttributes<HTMLDivElement>>

Expand Down
4 changes: 2 additions & 2 deletions storybook/storybook-react/src/Grid/Grid.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ const gridArgTypes = {
gapVertical: {
control: {
type: 'radio',
labels: { small: 'small', undefined: 'medium', large: 'large' },
labels: { undefined: 'none', small: 'small', medium: 'medium', large: 'large' },
},
options: ['small', undefined, 'large'],
options: [undefined, 'small', 'medium', 'large'],
},
paddingVertical: paddingArgType,
paddingTop: paddingArgType,
Expand Down