create-hover-class
v1.0.0
Published
Turn a JSON object into a hover class to use with inline styled components
Downloads
30
Maintainers
Readme
create-hover-class
Create css hover class
TODO: Why use this?
To Install
$ npm install --save create-hover-class
Usage
var createHC = require('create-hover-class')
var hoverObject = createHC({
color: 'rgba(0, 0, 0, 1)'
'font-weight': '700'
})
console.log(hoverObject)
// {name: 'cih3lymsf0000wly8uizhbo6d', css: '.cih3lymsf0000wly8uizhbo6d:hover {...}'}
Using insert-css
var createHC = require('create-hover-class')
var insertCSS = require('insert-css')
var h = require('virtual-dom/h')
var hoverObj = createHC({/* keyframe object */})
insertCSS(HoverObj.css)
h('label', {
className: hoverObj.name
}, 'I get big and red when you hover over me!')
API
createHC(hoverObject[, identifier])
-> object
hoverObject
Required
Type: object
Styles to apply on hover
identifier
Type: string
A class-name. create-hover-class
will generate a cuid if no class-name is specified
See Also
License
MIT