I'm populating a grid with various controls (in this example: up-down counter and a text box).
Currently, I'm injecting styles in the cls
member (in this example can be e.g. wide-input
and narrow-input
):
render(): ReactNode {
const input: CellItem[] = [
{ isUpdown: false, cls: 'wide-input' },
{ isUpdown: true, cls: 'narrow-input' },
];
return (
<GridContainer>
input.map(content, index): ReactNode => {
return (
content.isUpdown ?
<StyledUpdownCell className={content.cls} /> :
<StyledTextBoxCell className={content.cls} /> :
)
}
</GridContainer>
);
}
My question is what is the proper way to do it using styled-components?
Is there a way to inject any arbitrary style (content.cls
in this example, but tomorrow it could be also setting custom border color for instance)