0.0.2 • Published 8 years ago

paper-react v0.0.2

Weekly downloads
1
License
MIT
Repository
-
Last release
8 years ago

Paper-React

The experimental UI components, to help us better maintenance and extension of the component.

install

$ yarn install paper-react

Usage

import React from 'react'
import {Paper} from 'paper-react'

const View = Paper('div',{style:{display: 'flex', justifyContent:'space-around'}})
const Button = Paper('button')
const ButtonWithBackground = Paper('button', {style:{backgroundColor:'red'}})

const view = {
  green: {
    style: {backgroundColor: 'green'}
  },
  'say-hello': {
    onClick: () => {alert('hello')}
  }
}

//render
<View childProps={view}>

  <Button>
    init button
  </Button>

  //add init style
  <ButtonWithBackground>
    i am red
  </ButtonWithBackground>

  //overwrite style
  <ButtonWithBackground state="green">
    overwrite red, i am green
  </ButtonWithBackground>

  //add event
  <Button state="say-hello">
    click me
  </Button>
</View>

Demo

license

MIT. Copyright (c) viii.