Replies: 1 comment
-
This is working for me, I'm seeing the Here's the conversion happening if it helps: const Tab = styled.div<{ isActive: boolean }>`
${({ isActive }) =>
isActive
? tw`bg-white dark:bg-slate-800`
: tw`dark:bg-slate-800 bg-neutral-300`}
`
// ↓ ↓ ↓ ↓ ↓ ↓
const Tab = _styled.div`
${({
isActive
}) => isActive ? {
"--tw-bg-opacity": "1",
"backgroundColor": "rgb(255 255 255 / var(--tw-bg-opacity))",
"@media (prefers-color-scheme: dark)": {
"--tw-bg-opacity": "1",
"backgroundColor": "rgb(30 41 59 / var(--tw-bg-opacity))"
}
} : {
"--tw-bg-opacity": "1",
"backgroundColor": "rgb(212 212 212 / var(--tw-bg-opacity))",
"@media (prefers-color-scheme: dark)": {
"--tw-bg-opacity": "1",
"backgroundColor": "rgb(30 41 59 / var(--tw-bg-opacity))"
}
}}
`; |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
i have a styled component
in light mode and the tab is active it's background is white but in dak mode and the tab is active, the background remains transparent.
I expect that the background will be bg-slate-800 but its not the case.
I was thinking of passing isDark as a prop to this component but that would result to a pretty long ternary comparison.
Beta Was this translation helpful? Give feedback.
All reactions