Usual apologies if this is asked and answered...
I've got a stylesheet:
const styles = createStyles({
root: {background: 'blue', color: 'red'},
highlightedWrapper: {
'& $root': {
background: 'green',
color: 'black'
}
}
})
...which I invoke like this:
const useStyles = makeStyles(kanbanStyles);
...and then reference in my component like this:
const classes = useStyles()
So far, so good. What I'd like to be able to do is pass props into useStyles()
, which I'd then reference in the stylesheet. So this works:
const classes = useStyles({color: 'yellow'})
const styles = createStyles({
root: (props) => { return {background: 'blue', color: props.color}},
highlightedWrapper: {
'& $root': {
background: 'green',
color: 'black'
}
}
})
...but I cannot figure out how to invoke the function inside the sub-selector. Like, this doesn't work for me:
const styles = createStyles({
root: {background: 'blue', color: props.color},
highlightedWrapper: {
'& $root': {
background: 'green',
color: (props) => props.color
}
}
})
I've tried various permutations of the above syntax, putting it right after hightlightedWrapper:
, and right after '& $root':
, but nothing has worked.
Help?
Thanks!!