Skip to content

Support Styled Component Syntex #366

@owjs3901

Description

@owjs3901

Support Styled Component Syntex

Support styled

  1. static
const StyledDiv = styled.div`
  width: 100%
`

=>

const StyledDiv = (props: ComponentProps<'div'>)=><div {...props} className={"a" + " " + props.className} />
  1. variable
const StyledDiv = styled.div`
  width: 100%;
  bg: ${props=> props.blue};
  ${props => css`height: 100px`};
`

=>

const StyledDiv = (props: ComponentProps<'div'>)=><div {...props} className={"a b" + " " + (props=>"css-gen-class")(props) +" "+props.className} style={{
c: (props=>props.blue)(props),
...props.style}} />
  1. custom component
const StyledDiv = styled(A)`
  width: 100%
`

=>

const StyledDiv = (props: ComponentProps<A>)=><A props={props} className={"a" + " " + props.className} />
  1. object expression
const StyledDiv = styled.div({w: '100%'})

=>

const StyledDiv = (props: ComponentProps<'div'>)=><div {...props} className={"a" + " " + props.className} />

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions