Giter VIP home page Giter VIP logo

Comments (9)

vbersch avatar vbersch commented on June 16, 2024 2

The same problem exists for '&:hover', '&:before' and '&:after'.
Those all do work in jss in combination with theming.

from styled-jss.

kof avatar kof commented on June 16, 2024

Looks like a bug

from styled-jss.

lttb avatar lttb commented on June 16, 2024

Hi! Thank you for the issue, it looks like a bug with @media and function rules in jss, described here: cssinjs/jss#706

from styled-jss.

MarcusNotheis avatar MarcusNotheis commented on June 16, 2024

Example snippet for @vbersch's issue:
this works:

const Link = styled('a')({
  color: '#24292e',
  '&:before': {
    content: '"*"'
  }
})

this doesn't:

const Link = styled('a')((props) => ({
  color: '#24292e',
  '&:before': {
    content: '"*"'
  }
}))

Both patterns are working fine in react-jss

from styled-jss.

jmadson avatar jmadson commented on June 16, 2024

I love this JSS plugin! Unfortunately we're experiencing the same issue. Our team has been able to work around it by providing an object which contains functions when the props/theme are needed, but I feel it would be more efficient if we could provide a function which returns a single object instead.

For example (modifying the above for illustration purposes), this works:

const Link = styled('a')({
  color: ({ theme }) => theme.palette.primary.main
  textDecoration: "none",
  '&:hover': {
    textDecoration: "underline"
  }
})

But this does not:

const Link = styled('a')(({ theme }) => ({
  color: theme.palette.primary.main
  textDecoration: "none",
  '&:hover': {
    textDecoration: "underline"
  }
}))

from styled-jss.

likethemammal avatar likethemammal commented on June 16, 2024

Still experiencing the bug with '&:hover' as @MarcusNotheis described

from styled-jss.

HenriBeck avatar HenriBeck commented on June 16, 2024

We are currently working on porting this implementation to v10 of jss and also moving it into react-jss in cssinjs/jss#1094

from styled-jss.

HenriBeck avatar HenriBeck commented on June 16, 2024

There will be no more work done in this repo. I will add a test case for this bug for the new styled API to see if it's fixed there.

from styled-jss.

likethemammal avatar likethemammal commented on June 16, 2024

@HenriBeck Ah okay. Amazingly quick response, thanks!

from styled-jss.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.