-
Notifications
You must be signed in to change notification settings - Fork 63
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
Refactor dynamic interpolations to use a util #423
Conversation
a35fa09
to
19b2eb9
Compare
f4aa4bc
to
266928b
Compare
c779711
to
284d31a
Compare
* @param suffix | ||
* @param prefix | ||
*/ | ||
export default function cssCustomPropertyValue( |
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.
Do we need to do some perf testing here since we introduce this during runtime?
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.
Nevermind. It won't be that slow..hehe. Few if checks only.
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.
😄
Can we add bundlesize check for |
* @param prefix | ||
*/ | ||
export default function cssCustomPropertyValue( | ||
value: string | number | number, |
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.
value: string | number | number, | |
value: string | number | undefined | null, |
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.
done
9518198
to
b5b58c7
Compare
@@ -31,15 +31,15 @@ export type Interpolations<TProps extends Record<string, unknown>> = ( | |||
* props from `StyledProps`. | |||
*/ | |||
export interface StyledFunctionFromTag<TTag extends keyof JSX.IntrinsicElements> { | |||
<TProps extends Record<string, unknown>>( | |||
<TProps extends unknown>( |
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.
fixing types that i introduced a regression to in the TS change before, oops
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.
lgtm
Closes #346
Closes #333
This PR introduces an
ix
function which handles CSS custom property values, with an optional suffix/prefix.Currently only the suffix and prefix handling is done for template literal CSS, so for example:
Would result in this
ix
call:If we did this for object CSS instead you would need to handle this yourself:
Which ends up with the
ix
call: