bem / bem-react

A set of tools for developing user interfaces using the BEM methodology in React
http://bem.github.io/bem-react
Other
439 stars 64 forks source link

fix(classname): formatter type #605

Closed PavelPivkin closed 3 years ago

PavelPivkin commented 3 years ago
import { cn } from '@bem-react/classname'

const cat = cn('Cat')

//ok:
cat() // Cat
cat({ size: 'm' }) // Cat Cat_size_m
cat('Tail') // Cat-Tail
cat('Tail', { length: 'small' }) // Cat-Tail Cat-Tail_length_small

//!ok
cat(null) // Cat
cat(null, { size: 'm' }) // Cat

// mixes
// ok:
cat(null, ['Dog']) // Cat Dog
cat({ size: 'm' }, ['Dog', 'Horse'])

// !ok:
cat(['Dog'])
cat(null, { size: 'm' }, ['Dog', 'Horse']) // Cat