-
Notifications
You must be signed in to change notification settings - Fork 111
REQ: Utility classes scoped to breakpoints #1153
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
Comments
As they'd generate a bunch of css perhaps they could be optionally configured in settings? So they are only outputted to css when needed. |
I've certainly come across this need before - though have typically made a custom class then and used the media query mixins to do what I needed. A risk with these might be that they don't get used? |
Yeh, I thought about that. Maybe a Sass setting variable |
GOV.UK Frontend includes I could update our grid styles to pick them up as a freebie? They've deprecated https://github.com/search?q=org%3Anhsuk+govuk-grid-row%28&type=code Not necessarily a problem |
Ahh so the NHS grid layout uses So from mobile and up, the class But I've given it a go in #1154 and it's all working 🙌 .nhsuk-grid-column-one-quarter-from-tablet
.nhsuk-grid-column-one-third-from-tablet
.nhsuk-grid-column-one-half-from-tablet
.nhsuk-grid-column-two-thirds-from-tablet
.nhsuk-grid-column-three-quarters-from-tablet
.nhsuk-grid-column-full-from-tablet |
Is it worth considering reversing this and having the grid classes kick in at tablet+ width, and adding these instead: .nhsuk-grid-column-one-quarter-from-desktop
.nhsuk-grid-column-one-third-from-desktop
.nhsuk-grid-column-one-half-from-desktop
.nhsuk-grid-column-two-thirds-from-desktop
.nhsuk-grid-column-three-quarters-from-desktop
.nhsuk-grid-column-full-from-desktop I have a hunch that people’s expectations are that the default would be for the grid to kick in earlier? Would be a breaking change though... 🤔 |
Also the |
For comparison, I've opened a reverse version using It would be a breaking change but aligns with GOV.UK Frontend |
I think it would probably be better to have grids working from tablet rather than desktop - but it's also potentially an annoying breaking change. As I understand it it was likely done as it suited what the NHS.UK website needed. |
I was originally referring to some of the utility classes and making them scoped to breakpoints such as |
Good point @paulmsmith. @frankieroberto perhaps make a new issue for the point you raise? |
Utility classes are very useful, they save us needing to write new scss/css selectors to tweak spacing but by default they apply across all 'breakpoints'.
Often as components go from being stacked on small viewports to being laid out in columns for larger viewports, it would be helpful to be able to declaratively adjust that spacing.
For example:
.nhsuk-u-margin-bottom-0--from-desktop
or.nhsuk-u-margin-bottom-0--until-desktop
The text was updated successfully, but these errors were encountered: