-
How can I conditionally trigger a style in a separate file by prop? I am trying the following, but doesn't work: // component.tsx
import * as styles from './styles';
<Badge variant='primary' circle={circle} sx={styles.root}>Hello<Badge/> // styles.ts
export const root = ({ circle }) => {
circle
? {
borderRadius: 'full',
lineHeight: 1
}
: null;
}; The following works, but I would like to move all styles to a separate file: <Badge
variant='primary'
sx={{
...(circle
? {
borderRadius: 'full',
lineHeight: 1
}
: null)
}}
> |
Beta Was this translation helpful? Give feedback.
Answered by
sheedy
Sep 3, 2020
Replies: 1 comment 2 replies
-
I'm also interested to know how to achieve this. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
gvocale
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm also interested to know how to achieve this.