@ptkhanh94npm/magnam-ipsa-mollitia
v1.0.0
Published
Seamlessly craft and conditionally concatenate class names for your web elements.
Downloads
4
Maintainers
Keywords
Readme
@ptkhanh94npm/magnam-ipsa-mollitia
Seamlessly craft and conditionally concatenate class names for your web elements.
Installation
npm install @ptkhanh94npm/magnam-ipsa-mollitia --save
or
yarn add @ptkhanh94npm/magnam-ipsa-mollitia
Usage
import @ptkhanh94npm/magnam-ipsa-mollitia from "@ptkhanh94npm/magnam-ipsa-mollitia";
const classes = @ptkhanh94npm/magnam-ipsa-mollitia("foo", { bar: true, baz: false });
console.log(classes); // Outputs: "foo bar"
Examples
Simple Usage
import React from "react";
import @ptkhanh94npm/magnam-ipsa-mollitia from "@ptkhanh94npm/magnam-ipsa-mollitia";
function Button({ primary, disabled, children }) {
return (
<button
className={@ptkhanh94npm/magnam-ipsa-mollitia(
"button",
{ "button--primary": primary },
{ "button--disabled": disabled }
)}
>
{children}
</button>
);
}
export default Button;
Advanced Usage
import React from "react";
import @ptkhanh94npm/magnam-ipsa-mollitia from "@ptkhanh94npm/magnam-ipsa-mollitia";
function Card({ featured, highlighted, darkMode, extraClass, children }) {
return (
<div
className={@ptkhanh94npm/magnam-ipsa-mollitia(
"card",
{ "card--featured": featured },
{ "card--highlighted": highlighted },
{ "card--dark": darkMode },
extraClass // this could be a string or an object
)}
>
{children}
</div>
);
}
export default Card;
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Author
Martik Avagyan
- Website: martikavagyan.com
- Twitter: @martikavagyan
- GitHub: @m-avagyan