How to use the @bem-react/classnames.classnames function in @bem-react/classnames

To help you get started, we’ve selected a few @bem-react/classnames 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 bem / bem-react / packages / core / core.tsx View on Github external
const propValue = (props as any)[key]

        return modValue === propValue || (modValue === '*' && Boolean(propValue))
      })

      if (isModifierMatched) {
        const modifiers = modNames.reduce((acc: Dictionary, key: string) => {
          if (mod[key] !== '*') acc[key] = mod[key]

          return acc
        }, {})
        modifierClassName = modifierClassName || entity(modifiers)

        const nextProps = Object.assign({}, props)

        nextProps.className = classnames(modifierClassName, props.className)
          // Replace first entityClassName for remove duplcates from className.
          .replace(`${entityClassName} `, '')

        if (enhance !== undefined) {
          if (ModifiedComponent === undefined) {
            ModifiedComponent = enhance(WrappedComponent as any)

            if (__DEV__) {
              setDisplayName(ModifiedComponent, {
                wrapper: 'WithBemModEnhance',
                wrapped: WrappedComponent,
              })
            }
          }
        } else {
          ModifiedComponent = WrappedComponent as any

@bem-react/classnames

BEM React ClassNames merge

MPL-2.0
Latest version published 3 years ago

Package Health Score

60 / 100
Full package analysis

Popular @bem-react/classnames functions