Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "classwrap", | ||
"description": "320B JavaScript function for conditionally concatenating classNames.", | ||
"version": "1.0.0", | ||
"description": "0.3 KB JavaScript utility for conditionally concatenating class names.", | ||
"version": "1.0.1", | ||
"main": "dist/classwrap.js", | ||
@@ -6,0 +6,0 @@ "jsnext:main": "src/index.js", |
@@ -6,3 +6,3 @@ # Classwrap | ||
Classwrap is a (340B) JavaScript function for conditionally concatenating [class names](https://developer.mozilla.org/en-US/docs/Web/API/Element/className). | ||
Classwrap 0.3 KB JavaScript utility for conditionally concatenating [class names](https://developer.mozilla.org/en-US/docs/Web/API/Element/className). | ||
@@ -12,12 +12,21 @@ [Try it Online](https://codepen.io/jbucaran/pen/GMRjRB) | ||
```js | ||
function HelloButton({ active, label }) { | ||
const name = classwrap([ | ||
"btn", | ||
"btn-large", | ||
{ | ||
"btn-active": active | ||
} | ||
]) | ||
return <button class={name}>{label}</button> | ||
function ToggleButton({ toggle, isOn }) { | ||
return ( | ||
<div class="btn" onclick={toggle}> | ||
<div | ||
class={classwrap({ | ||
circle: true, | ||
off: !isOn, | ||
on: isOn | ||
})} | ||
/> | ||
<span | ||
class={classwrap({ | ||
textOff: !isOn | ||
})} | ||
> | ||
{isOn ? "ON" : "OFF"} | ||
</span> | ||
</div> | ||
) | ||
} | ||
@@ -28,2 +37,6 @@ ``` | ||
![Classwrap](https://user-images.githubusercontent.com/56996/30416101-cda83bd4-9965-11e7-9db5-230ba3fc83fd.gif) | ||
## Installation | ||
@@ -30,0 +43,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7549
107
7