1.2.6 • Published 9 years ago

brisky-style v1.2.6

Weekly downloads
3
License
ISC
Repository
github
Last release
9 years ago

brisky-style

Build Status js-standard-style npm version Coverage Status

Set style properties on brisky-elements, automatically adds prefixes

basic

  const render = require('brisky/render')
  const app = render({
    field: {
      style: {
        opacity: {
          $: 'animal',
          $transform: (val) => val === 'cat' ? 1 : 0
        }
      }
    }
  }, { animal: 'cat' })

  // returns opacity 1 when state.animal equals "cat"

px

Automaticly converts numbers to [number] + px

  • width
  • height
  • left
  • right
  • bottom
  • top
  • margin
  • padding
  const render = require('brisky/render')
  const app = render({
    field: {
      style: {
        width: { $: width }
      }
    }
  }, { width: 100 })

  // renders a div with width: 100px

Add your own px property

  const render = require('brisky/render')
  const app = render({
    field: {
      style: {
        something: {
          type: 'px',
          $: 'something'
        }
      }
    }
  }, { something: 100 })
  // renders a div with style - something: 100px

transform

Adds helpers for x y and rotate

  const render = require('brisky/render')
  const app = render({
    field: {
      style: {
        transform: {
          x: { $: 'x' },
          y: { $: 'y' },
          rotate: { $: 'rotate' }
        }
      }
    }
  }, { x: 100, y 100, rotate: 20 })

  // renders a div with transform style
  // translate3d(100px,100px,0) scale(0.1) rotate(20deg)
1.2.6

9 years ago

1.2.5

9 years ago

1.2.4

10 years ago

1.2.3

10 years ago

1.2.2

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.0

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago