stitchesjs / stitches

[Not Actively Maintained] CSS-in-JS with near-zero runtime, SSR, multi-variant support, and a best-in-class developer experience.
https://stitches.dev
MIT License
7.72k stars 251 forks source link

Problem `as` and `css` when used together. #1113

Closed s-kobets closed 1 year ago

s-kobets commented 1 year ago

Bug report

Describe the bug

Hi, I have problem when used as and css together.

To Reproduce

  1. I created component with stitches

    
    const StyledTag = styled('span', {
    ...tw`
    border 
    border-current`,
    
    variants: {
    theme: {
      warning: tw`text-[#c5770f] bg-yellow-500`,
    },
    },
    })

function Tag(props) { return <StyledTag {...props} /> }

2. Render components

<> <Tag theme="warning" css={twtext-red-500}

Tag 1 <Tag as="div" theme="warning"

Tag 2 <Tag as="div" theme="warning" css={twtext-red-500}

Tag 3 </>


3. See that `Tag 3` don't get styles for theme `warning`

Expected behavior

I want to see that Tag 3 will be to the same Tag 1. Got styles for border and background

Screenshots

problem-screenshot

System information

s-kobets commented 1 year ago

All work, I use twin.macro, tailwind, stitches. For stitches work all right.

sunwrobert commented 1 year ago

I'm also seeing issues when using as and css together. It seems that if I use as, the css prop overwrites all of the styles instead of just the relevant style that it declares