1.0.0 • Published 5 years ago

class-func-style v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

Class Func Style

child of classnames library https://github.com/JedWatson/classnames by JedWatson

utility for classNames and functional/utility css styling

npm

npm install class-func-style --save

yarn

yarn add class-func-style

Output

This function always return className: 'strings of style' when invoke with a truthy argument.

To Use

let listOfFuncCSS = classFuncStyle({
  'HeaderBackground':'bg-black'
})

listOfFuncCSS('HeaderBackground') // -> {className:'bg-black'}
listOfFuncCSS({
  'HeaderBackground':true  // -> {className:'bg-black'}
})
listOfFuncCSS(['HeaderBackground']) // -> {className:'bg-black'}

// it also accepts non-declared value as long as it was invoke first
let funcStyle = classFuncStyle()
funcStyle('btn',{'btn-error':false}) // -> {className:'btn'}

Motivation in writing

Finding better workflow in using a functional/utility style of css writing.