-
Notifications
You must be signed in to change notification settings - Fork 89
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: optimize IconSpinner #3099
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
image, | ||
size = 24, | ||
children, | ||
bgColor = '--cow-container-bg-01', |
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.
Is it possible to get this value from a const or even better, make these color names an ENUM?
Imagine if we want to pass something else.
How will we know what values are expected?
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.
Imagine if we want to pass something else.
How will we know what values are expected?
I think there we probably need to agree to only always pass CSS color variables? Can you elaborate how an ENUM would add value here?
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.
The colors can be defined in a central place, while also being more legible.
For example:
enum ColorVariables = {
CONTAINER_BG_01 = '--cow-container-bg-01'
}
type Props = {
// ...
bgColor: ColorVariables
}
function Component({
// ...
bgColor = CONTAINER_BG_01
}: Props) {
// ...
Note: code is not tested, might not work or need tweaks.
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.
Updated!
Merging to keep this going. @alfetopito I've addressed your ENUM comment. Feel free to comment on this post-merge. |
enum ColorVariables { | ||
CONTAINER_BG_01 = '--cow-container-bg-01', | ||
} |
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.
Yes, that's what I meant!
Sort of 😅
This is the idea, but the suggestion is to put all of the variable (names?) in this enum.
Then you use the enum in the source css where they are declared, and when naming them individually.
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 change by itself is breaking the build.
Summary
cosmos
constant file with shared items.Screen.Recording.2023-08-31.at.17.33.24.mov