Migrating from Canvas Kit React Theme Breakpoints #105
alanbsmith
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Migrating from Canvas Kit React Theme Breakpoints
Overview
If you've been using Canvas Kit, you're probably familiar with our theme breakpoints that are provided in Emotion's theme object through the
CanvasProvider
. While we'll continue to support those breakpoints for now, we'll remove their usage internally and eventually remove them entirely.While it was convenient to have breakpoint values and functions in the theme, they don't really belong there. They will be replaced with our new breakpoint tokens in
@workday/canvas-tokens-web
. These CSS variables are much more straightforward to use and don't rely on Emotion's runtime.Migrating From Canvas Kit React Breakpoint Values
Previously, if you were adding responsive styles to a Canvas Kit Card, you would need to do something like this:
With
@workday/canvas-tokens-web@^1.3.0
, you can use the token values directly, without needing to use Emotion'sstyled
function at all.The names of the tokens are identical, making it simple to map between them.
Migrating from Canvas Kit React Breakpoint Functions
Canvas Kit also provides breakpoint functions which made breakpoint media queries a bit easier to write. Below, we've reused the example above with a breakpoint function.
The example above can be refactored with our new tokens:
Conclusion
We think you'll enjoy using these new breakpoint tokens and find the migration process very straightforward. If you have questions, please reach out to our team. We're happy to help.
Beta Was this translation helpful? Give feedback.
All reactions