-
Notifications
You must be signed in to change notification settings - Fork 335
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
Simplify the grid mixins #1090
Simplify the grid mixins #1090
Conversation
This is to be consistent with other functions which are namespaced under the govuk prefix. We keep grid-width as a deprecated alias which we can remove in the next major version.
Wrapping the row functionality up in a mixin offers little other than the ability to use a custom name, but we’re not sure there’s a need for users to do that. Simplify the code by deprecating the mixin and just using the code to create the concrete class directly.
The class names generated by the mixin are not flexible enough, as the width is just appended to the class name. In spiking how we might add an extended grid we found the generated class names a little yoda-ish, for example `govuk-grid-column--at-desktop-one-quarter` (bonus points if you actually read that in Yoda’s voice). Moving the class naming out of the mixin and doing it within the objects layer is also more consistent with the rest of Frontend, and means that users who do use the grid mixins directly don’t have to fit with the constraints of our class name structure.
I think there would be three issues raised against 3.0 off the back of this work:
|
|
||
$govuk-grid-widths: ( | ||
one-quarter: 25%, | ||
one-third: 33.3333%, |
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.
Quick question. Is it worth letting the Sass language handle the precision here?
Swapping this out for:
one-third: (100/3) * 1%,
I believe this is possible in a map as according to the docs: "Both the keys and values in maps can be any SassScript object".
I doubt it would have any effect on the rounded result so may just be best left hardcoded.
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.
Might be worth keeping it simple since it works and doesnt require thinking.
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.
Nice work, this makes the mixin much less complicated while using a regular CSS feature instead of the class
option.
I've checked the review application grid page and it renders the regular classes correctly.
👍 for noting we need to open issues to track the deprecations.
https://govuk-frontend-review-pr-1090.herokuapp.com/examples/grid
Verified that the CSS output is the same using both snapshots and a quick MD5 check:
|
#1090 deprecated this mixin and left it in as an alias to govuk-grid-width. ACTION: Replace all instances of grid-width with govuk-grid-width
#1090 deprecated this mixin and left it in as an alias to govuk-grid-width. ACTION: Replace all instances of grid-width with govuk-grid-width
This functionality was previously deprecated in v2.5.0, although it was unfortunately not mentioned in the release notes. [1]: #1090
This functionality was previously deprecated in v2.5.0 [1], although it was unfortunately not mentioned in the release notes. [1]: #1090
#1090 deprecated this mixin and left it in as an alias to govuk-grid-width. ACTION: Replace all instances of grid-width with govuk-grid-width
This functionality was previously deprecated in v2.5.0 [1], although it was unfortunately not mentioned in the release notes. [1]: #1090
#1090 deprecated this mixin and left it in as an alias to govuk-grid-width. ACTION: Replace all instances of grid-width with govuk-grid-width
This functionality was previously deprecated in v2.5.0 [1], although it was unfortunately not mentioned in the release notes. [1]: #1090
This simplifies the grid to make it easier to add the extended grid.
grid-width
function togovuk-grid-width
to be consistent with other functions, retaininggrid-width
as as deprecated aliasgovuk-grid-row
mixin to create a new concrete class and mark the mixin as deprecatedgovuk-grid-column
mixin to allow class name to be suppressed by setting$class
tofalse
.class
parameter of thegovuk-grid-column
mixin as deprecated$govuk-grid-widths
map.https://trello.com/c/1aBarhHU/1613-add-extended-grid-to-govuk-frontend-pair