@lemuria/control-style

1.0.0 • Public • Published

@lemuria/control-style

npm version

@lemuria/control-style is Extracts CSS Properties From Component Properties Map And Returns The Composed Style.

yarn add @lemuria/control-style

Table Of Contents

API

The package is available by importing its default function:

import controlStyle from '@lemuria/control-style'

controlStyle(
  style: string|undefined,
  props: Object<string, ?>,
): void

Extracts CSS Properties From Component Properties Map And Returns The Composed Style. Returns the joined style as the string, or a hash with the style rules if no style was given. Deletes CSS properties from the passed props object.

import controlStyle from '@lemuria/control-style'

const Component = ({ style, ...props }) => {
  return controlStyle(style, props)
}

// return as string
const res = Component({
  style: 'padding: 10px',
  margin: '1rem',
  'border-radius': '5px'
})
console.log(res)

// return as object
const res1 = Component({
  margin: '1rem',
  'border-radius': '5px',
})
console.log(res1)
margin:1rem;border-radius:5px;padding: 10px
{ margin: '1rem', 'border-radius': '5px' }

Copyright

(c) Art Deco 2019

Package Sidebar

Install

npm i @lemuria/control-style

Homepage

artd.eco/

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

29.7 kB

Total Files

13

Last publish

Collaborators

  • zvr