@chaos-design/classnames
v0.0.3
Published
A simple utility for conditionally joining classNames
Downloads
5
Readme
@chaos-design/classnames
将 classNames 连接在一起
使用
classnames
import c, { classnames } from '@chaos-design/classnames';
// c === classnames
const classList = c('chaos', 'classnames');
console.log(classList); // chaos classnames
c('foo', 'bar'); // => 'foo bar'
c('foo', { bar: true }); // => 'foo bar'
c({ 'foo-bar': true }); // => 'foo-bar'
c({ 'foo-bar': false }); // => ''
c({ foo: true }, { bar: true }); // => 'foo bar'
c({ foo: true, bar: true }); // => 'foo bar'
const cp = prefix('chaos-');
const classList = c('classnames');
console.log(classList); // chaos-classnames
prefix
import { prefix } from '@chaos-design/classnames';
c('foo', 'bar'); // => 'foo bar'
c('foo', { bar: true }); // => 'foo bar'
c({ 'foo-bar': true }); // => 'foo-bar'
c({ 'foo-bar': false }); // => ''
c({ foo: true }, { bar: true }); // => 'foo bar'
c({ foo: true, bar: true }); // => 'foo bar'
const cp = prefix('chaos-');
const classList = c('classnames');
console.log(classList); // chaos-classnames