Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[react-jss][jss-compose] Support function values for composed rules #474

Open
lttb opened this issue Apr 21, 2017 · 2 comments
Open

[react-jss][jss-compose] Support function values for composed rules #474

lttb opened this issue Apr 21, 2017 · 2 comments
Labels
bug It went crazy and killed everyone. complexity:moderate We talked about it, you can do it! plugin When unplugged is fine

Comments

@lttb
Copy link
Member

lttb commented Apr 21, 2017

It would be great to support function values with composed rules.

Online example

import injectSheet from 'react-jss'

const styles = {
  title: {
    fontSize: 20,
    color: ({ color }) => color
  },
  subtitle: {
    composes: '$title',
    fontSize: 16,
  }
}

const App = injectSheet(styles)(({ classes }) => (
  <div>
    <h1 className={classes.title}>jss</h1>
    {/* h2 need to be with green color too */}
    <h2 className={classes.subtitle}>jss</h2>
  </div>
))

render(
  <App color="green" />,
  document.getElementById('root')
)
@lttb lttb added the enhancement No kittens die if we don't do that. label Apr 21, 2017
@kof kof added the complexity:moderate We talked about it, you can do it! label Aug 20, 2017
@kof kof added the plugin When unplugged is fine label Mar 19, 2018
@kof kof closed this as completed Jun 19, 2018
@kof
Copy link
Member

kof commented Oct 11, 2018

Reproduced the issue on codesandbox https://codesandbox.io/s/v3vo4752ol

The problem is that we are using 2 separate style sheets for dynamic/static styles in react-jss, because we want to reuse the static styles across all components and composes basically refers to the static one.

@kof kof changed the title [jss-compose] Support function values for composed rules [react-jss][jss-compose] Support function values for composed rules Oct 11, 2018
@kof kof reopened this Oct 11, 2018
@kof kof added bug It went crazy and killed everyone. and removed enhancement No kittens die if we don't do that. labels Oct 11, 2018
@kof
Copy link
Member

kof commented Oct 11, 2018

Also to consider #501

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It went crazy and killed everyone. complexity:moderate We talked about it, you can do it! plugin When unplugged is fine
Projects
None yet
Development

No branches or pull requests

2 participants