Open quangkhaidam93 opened 1 month ago
Temporary solution:
Create ThemeProvider
and provide dynamic css variables through style props
return (
<StyledThemeProvider
theme={{
colors: {
primary: colorConfig?.primary_color ?? '#000000',
secondary: colorConfig?.secondary_color ?? '#000000',
headline: colorConfig?.headline_color ?? '#000000',
pageBackground: '#F5F9FF',
errorMessage: '#E3173C',
},
}}
>
<Container
style={{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
'--primary-color': colorConfig?.primary_color ?? '#000000',
'--secondary-color': colorConfig?.secondary_color ?? '#000000',
}}
>
{children}
</Container>
</StyledThemeProvider>
);
Use css variables in Component
css file
.icon {
width: 24px;
height: 24px;
path {
fill: '#66798B';
}
}
.icon-active {
width: 24px;
height: 24px;
path {
fill: var(--primary-color);
}
}
Component file
<ReactSVG
className={clsx({ 'icon-active': selectedButtonId === button.id, icon: selectedButtonId !== button.id })}
src={button.icon}
/>
I have an typescript issue
Type instantiation is excessively deep and possibly infinite (ts-2589)
when usingreact-svg
withstyled-component
. Please help me resolve this issue. Thank in advance.My code is below
Some additional image(s):