How to use the substyle.defaultPropsDecorator function in substyle

To help you get started, we’ve selected a few substyle 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 jfschwarz / substyle / packages / substyle-jss / src / createPropsDecorator.js View on Github external
const decorateProps = stylingProps => {
    const decoratedStylingProps = defaultPropsDecorator(stylingProps)
    const { style, className: baseClassName, ...rest } = decoratedStylingProps

    if (!style) {
      return decoratedStylingProps
    }

    const ruleName = hash(style)

    // prepend rule to the sheet if it does not already exist
    const rule =
      sheet.getRule(ruleName) ||
      sheet.addRule(ruleName, mapPseudoSelectors(style), { index: 0 })

    const className = rule.options.classes[ruleName]

    return {
github jfschwarz / substyle / packages / substyle-glamor / src / propsDecorators.js View on Github external
export const decorateAsDataAttributes = props => {
  const { style, className } = defaultPropsDecorator(props)
  return {
    ...css(style),
    className,
  }
}

substyle

Universal styling for reusable React components

MIT
Latest version published 3 years ago

Package Health Score

50 / 100
Full package analysis