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 breakpoints to be overriden by products #3599

Merged
merged 2 commits into from
Feb 4, 2025

Conversation

davidsauntson
Copy link
Contributor

This makes overriding the breakpoint settings possible in products that use the design system. @use requires you to explicitly override variables when you import a module, rather than respecting what the global state of the @used file is. This changes ensures that the global values of the breakpoints are respected at all layers of the ITCSS triangle, allowing products to override the breakpoint variables as they wish.

The use case for this is a bit odd - in an energy app we are iframing a form into some advice content to provide a different type of journey for users. The content columns width in an advice collection page is smaller than the medium breakpoint in the design system, so mobile styles were showing for the iframed app on desktop.

Before

image

After

image

Similar to #3342

@davidrapson
Copy link
Contributor

davidrapson commented Feb 3, 2025

Good spot, we'll need to come back to this to try and get @use working across the board, but looks like that needs a fair bit more thought to work? (I've found the transition from @import quite hard to get my head around from the sass docs)

This makes overriding the breakpoint settings possible in products that use the design system.  `@use` requires you to explicitly override variables when you import a module, rather than respecting what the global state of the `@use`d file is.  This changes ensures that the global values of the breakpoints are respected at all layers of the ITCSS triangle, allowing products to override the breakpoint variables as they wish.
@davidsauntson davidsauntson force-pushed the fix/overridable-breakpoints branch from f5a09a1 to db71602 Compare February 4, 2025 14:20
@davidsauntson
Copy link
Contributor Author

Good spot, we'll need to come back to this to try and get @use working across the board, but looks like that needs a fair bit more thought to work? (I've found the transition from @import quite hard to get my head around from the sass docs)

I think where we are @useing we just need to @import instead, following the pattern here and in the other PR for the grid settings. But it's quite a big change to do it all in one go.

@davidsauntson davidsauntson merged commit 7c44c32 into main Feb 4, 2025
18 checks passed
@davidsauntson davidsauntson deleted the fix/overridable-breakpoints branch February 4, 2025 14:26
@davidrapson
Copy link
Contributor

Thinking more about https://sass-lang.com/blog/import-is-deprecated/ and what we do in the longer term, but agree needs a bit of coordination 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants