cssinjs / jss

JSS is an authoring tool for CSS which uses JavaScript as a host language.
https://cssinjs.org
MIT License
7.08k stars 400 forks source link

[jss-compose] When composing from a class that takes props, the inheriting class needs props also #1319

Open ilyador opened 4 years ago

ilyador commented 4 years ago

I have a class that takes props, when I extend it, the extension doesn't work unless the class that extends also takes props.

const useStyles = makeStyles({
  icon: props => ({ // <---------- base class
    fontSize: Number(props.size)
  }),
  successIcon: props => ({
    composes: '$icon', // This works, because it takes props, even though not using them
    color: 'green'
  }),
  failIcon: {
    composes: '$icon',  // This extension should work, but it doesn't
    color: 'red'
  }
})

React-JSS 10.1.1 Material UI 4.9.7

kof commented 4 years ago

Hi, makeStyles is material-ui wrapper, can you reproduce this with react-jss? Ideally an example with codesandbox.