How to use the @xstyled/system.createSystemComponent function in @xstyled/system

To help you get started, we’ve selected a few @xstyled/system examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / xstyled__system / xstyled__system-tests.tsx View on Github external
type CustomSystemBoxProps = MarginProps & PaddingProps;

const CustomSystemBox = styled.div`
    ${customSystem}
`;

const customSystemBoxTest = () => (
    <div>
        
    </div>
);

// createSystemComponent

const InnerSystemComponentBox = createSystemComponent(React, 'div', shadows);

const SystemComponentBox = styled(InnerSystemComponentBox)`
    ${shadows}
`;

const systemComponentBoxTest = () =&gt; (
    <div>
        
    </div>
);

// TH

th('colors.primary900')({});

th.color(2)({});
github smooth-code / xstyled / packages / styled-components / src / styled.js View on Github external
Object.keys(scStyled).forEach(key => {
  styled[key] = styled(key)
  styled[`${key}Box`] = styled(
    Box.withComponent(createSystemComponent(React, key)),
  )
})
github smooth-code / xstyled / packages / styled-components / src / styled.js View on Github external
createStyle.attrs = attrs => {
    const nextCreateStyle = baseCreateStyle.attrs(attrs)
    return getCreateStyle(nextCreateStyle)
  }
  createStyle.withConfig = config => {
    const nextCreateStyle = baseCreateStyle.withConfig(config)
    return getCreateStyle(nextCreateStyle)
  }
  return createStyle
}

export function styled(component) {
  return getCreateStyle(scStyled(component))
}

const InnerBox = createSystemComponent(React)

export const Box = styled(InnerBox)(createBox)

styled.box = styled(Box)

Object.keys(scStyled).forEach(key => {
  styled[key] = styled(key)
  styled[`${key}Box`] = styled(
    Box.withComponent(createSystemComponent(React, key)),
  )
})