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

Media queries don't work with function rules #706

Closed
lttb opened this issue Apr 29, 2018 · 1 comment
Closed

Media queries don't work with function rules #706

lttb opened this issue Apr 29, 2018 · 1 comment
Labels
bug It went crazy and killed everyone. complexity:high Best brains need to talk about it.

Comments

@lttb
Copy link
Member

lttb commented Apr 29, 2018

Online example

Related to the cssinjs/styled-jss#66

It looks like media queries don't work with function rules.

const styles = {
  container: props => ({
    padding: props.active ? 10 : 20,
    '@media screen and (min-width: 100px)': {
      color: 'red',
      background: props.active ? 'white' : 'gray',
    },
  }),

  container2: {
    padding: props => (props.active ? 10 : 20),
    '@media screen and (min-width: 100px)': {
      color: 'red',
      background: props => (props.active ? 'white' : 'yellow'),
    },
  },
}

const sheet = jss.createStyleSheet(styles, {link: true}).attach()
sheet.update({active: false})

const App = () => (
  <React.Fragment>
    <div className={sheet.classes.container}>
      <h2>@media does not work</h2>
    </div>
    <div className={sheet.classes.container2}>
      <h2>@media works well</h2>
    </div>
  </React.Fragment>
)
@kof kof added bug It went crazy and killed everyone. complexity:high Best brains need to talk about it. labels May 31, 2018
@kof
Copy link
Member

kof commented Jun 19, 2018

tbc in #682

@kof kof closed this as completed Jun 19, 2018
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:high Best brains need to talk about it.
Projects
None yet
Development

No branches or pull requests

2 participants