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

CSS specificity #57

Closed
secretlifeof opened this issue Oct 29, 2020 · 2 comments
Closed

CSS specificity #57

secretlifeof opened this issue Oct 29, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@secretlifeof
Copy link

Description

Good morning Kripod!

I am trying to do some benchmarking with your library and noticed that there is an issue with specificity when combining different CSS classes like below.

import { css } from 'otion'

const classNames = css({
  borderColor: 'transparent',
  borderStyle: 'solid',
  borderTopWidth: '0',
})

const Box = () => {
  return (
    <div
      className={`${css({
        borderBottomColor: 'green',
      })} ${classNames}`}
    />
  )
}

This should have borderBottomColor as the borderColor, but it is transparent.

Environment

Does this command work? It outputs this:
npx: installed 1 in 3.159schMetadata: sill resolveWithNewModule isexe@2.0.0 checking installable status
npx: installed 73 in 8.305s

"otion": "^0.6.2",
"react": "^16.8.6",
"react-dom": "^16.8.6",

@secretlifeof secretlifeof added the bug Something isn't working label Oct 29, 2020
@kripod
Copy link
Owner

kripod commented Oct 30, 2020

Thank you for opening this issue!

Unfortunately, class composition is not yet implemented as a feature, and thus, only different properties should be mixed within a className.

Please follow #47 for proposed solutions.

@kripod kripod closed this as completed Oct 30, 2020
@secretlifeof
Copy link
Author

I think this is different than the solutions related to #47. It is related to a global className specificity. What I meant was that BorderBottomColor should always overwrite borderColor.

Like your rulePrecedence.

Border has specificity 1
BorderColor has specificity 2
BorderBottomColor has specificity 3

Looking forward to your version 1 and 2.

Thank you again for taking the time to put this library together!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants