-
Notifications
You must be signed in to change notification settings - Fork 0
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
feature: spacing utilities #54
Conversation
I feel like the alternative to the clashing problem is to namespace the classes, right? The potential cost of this update is that it makes addressing the classes somewhat ambiguous. Do we imagine having to constantly refer to the documentation to figure out the class chain? Is that assessment fair? Does it miss anything? |
Good points @liamegan I changed my mind mainly because SCSS is a pain to debug and document dynamic classes like this. Whereas with a simple typed object, we get this DX: Screen.Recording.2023-11-17.at.5.16.31.PM.movYou don't even need the documentation. That all being said. This does create an extra layer of complexity because the SCSS now needs to be represented in JS as well. But these utilities are NEVER changed. The ones that come with Corgi for example we never ever edit them. On thing to note is that It would also be easy to simply remove this JS layer if required too and just use the classnames. You'd just import them in the global styles and done! |
Asking to confirm - this is the same as Corgi's I wouldn't be opposed to it but after seeing the recording I could imagine the autocomplete getting a bit frustrating - but This may also just be a stylistic thing, but seeing
P.S. song 🎸 |
@rvno great notes! This works the same way as the utils we have right now. The values are I improved the documentation following your feedback. Also you brought up a good point maybe I should move the breakpoint key to a different position. |
@marlonmarcello I'm personally fine with either haha. While the latter matches the classes, I'm now beginning to read the former as as the "2nd option from the margin values", as opposed to the latter where it's the "2nd value from the mediums" 😆 . |
@rvno we could the word instead of the number too so we don't use <div className={classnames([
spacing.margin.two,
spacing.lg.margin.four
])} /> |
Sorry for the late reply @marlonmarcello ! I like how the written out numbers looks but not sure how everyone would feel about writing out the individual numbers so let's see what everyone else thinks - either seem fine to me though. |
Just a reminder that this is an exploration. We can definitely just use these as global utilities like we currently do on Corgi if we want to. It's just a matter of removing the JS and renaming that file. |
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 an interesting solution @marlonmarcello, I say let's go for it 👍. Why not take the leap — we can always revert to namespaced utility classes if we decide that works better for us in the future. Nice work!
Just a couple suggestions here:
- can we add one section to the docs that use the
top
orleft
values, just to remove any ambiguity around that usage? - minor typos in the docs
Description
We need utility classes. But we don't want them to clash with other libraries and potentially client styles.
Solution
We are using CSS modules to leverage localized class names but exposing them through an object.
Opening this PR to get some feedback on how we feel about this style of utilities.
Usage