Comparing version 1.1.0 to 1.1.1
@@ -29,3 +29,7 @@ 'use strict'; | ||
return Object.keys(val).map(function (key) { | ||
return typeof val[key] === 'boolean' ? !!val[key] ? block + '--' + dashify(key) : block : block + '--' + key + '-' + dashify(val[key]); | ||
if (is(val[key], 'boolean')) { | ||
return !!val[key] ? block + '--' + dashify(key) : '-1'; | ||
} else { | ||
return block + '--' + key + '-' + dashify(val[key]); | ||
} | ||
}); | ||
@@ -43,4 +47,4 @@ } | ||
return args.filter(removeNotSupportedTypes).map(handleBlocks.bind(null, block)).map(handleModifiers.bind(null, block)).join(' ') || block; | ||
return (args.filter(removeNotSupportedTypes).map(handleBlocks.bind(null, block)).map(handleModifiers.bind(null, block)).join(' ').replace(',', ' ') || block).replace('-1', '').trim(); | ||
}; | ||
}; |
{ | ||
"name": "b3m", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"main": "build/index.js", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -15,3 +15,3 @@ # b3m | ||
``` | ||
$ yarn add b3m --save-dev | ||
$ yarn add b3m --dev | ||
``` | ||
@@ -27,5 +27,3 @@ | ||
cn() | ||
// button | ||
cn() // button | ||
cn('element') // button__element | ||
@@ -41,1 +39,26 @@ cn('big', 'blue') // button__big button__blue | ||
``` | ||
## Example | ||
**React** | ||
``` | ||
import React from 'react' | ||
import b3m from 'b3m' | ||
const cn = b3m('element') | ||
export default ({buttonStatus = 'visible', iconModifiers = ['big-icon']}) => ( | ||
<div className={cn()}> | ||
<button className={cn('button', { status: buttonStatus, blue: true, hover: false })}></button> | ||
<div className={cn('icon', iconModifiers)}></div> | ||
</div> | ||
) | ||
// rendered: | ||
<div class="element"> | ||
<button class="element__button element--status-visible element--blue"></button> | ||
<div class="element__icon element--big-icon"></div> | ||
</div> | ||
``` |
4873
38
62