-
Notifications
You must be signed in to change notification settings - Fork 15
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: add grid gap property for more flexibility #732
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's looking good! Can you add the new gap props to storybook?
As for the readme, we may have to split the grid-col component out into it's own directory since the build command will just reset it to the way it was before.
@ethanWallace apologies, the stories completely slipped my mind. I will separate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found a few places for code improvement
|
||
if (newValue != undefined && !values.includes(newValue)) { | ||
this.gapTablet = undefined; | ||
console.error('Not a valid spacing value for gap-tablet.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For logging errors, we now have a helper util logError
https://github.com/cds-snc/gcds-components/blob/main/packages/web/src/utils/utils.ts#L122-L138
|
||
if (newValue != undefined && !values.includes(newValue)) { | ||
this.gapDesktop = undefined; | ||
console.error('Not a valid spacing value for gap-desktop.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another spot where we can use the logError
helper util
// Handle columns | ||
setGridProperty(columns, 'columns'); | ||
setGridProperty(columnsTablet, 'columns', '-tablet'); | ||
setGridProperty(columnsDesktop, 'columns', '-desktop'); | ||
|
||
// Handle gap | ||
setGridProperty(gap, 'gap'); | ||
setGridProperty(gapTablet, 'gap', '-tablet'); | ||
setGridProperty(gapDesktop, 'gap', '-desktop'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is clear, it's great!
Summary | Résumé
Changes
Adding new
gap
,gap-tablet
, andgap-desktop
properties to the grid component that will allow users to change the value of the grid gap depending on the viewport and adhere to the vertical rhythm of the new typography.The allowed spacing values for each of the new
gap
properties are:150 | 175 | 200 | 225 | 250 | 300 | 350 | 400 | 450 | 500 | 550 | 600 | 650 | 700 | 750 | 800
Additionally, I manually updated the grid readme to include all grid props. It was previously only loading the grid-col props. The new readme can be found here.
How to test
The new properties can be tested by adding
gap
,gap-tablet
, orgap-desktop
to the grid component with any of the above spacing values. Here is an example that can be used to test:Zenhub ticket
This is the Zenhub ticket for the change.
✅ Token package update required
The token package has been updated to it's latest version
2.1.0
.