1.0.0-beta2 • Published 10 years ago
react-component-permutations v1.0.0-beta2
react-component-permutations
WIP
Uses propTypes to create an array of React component props to display various permutations.
npm i react-component-permutationsUsage
import fs from 'fs'
import getPermutations from 'react-component-permutations'
const src = fs.readFileSync('./components/Button.js', 'utf8')
const options = {}
const permutations = getPermutations(src, options)Options
strings- Array - strings to render forPropType.stringnumbers- Array - numbers to render forPropType.numberarrays- Array - arrays to render forPropType.arrayobjects- Array - objects to render forPropType.objectnodes- Array - nodes to render forPropTypes.node[key]- Array - any prop name to add to the returned objects array
Demo
Given a button component with these propTypes:
Button.propTypes = {
big: React.PropTypes.bool,
color: React.PropTypes.oneOf(colorKeys),
pill: React.PropTypes.bool,
outline: React.PropTypes.bool
}The rendered result would look something like this:

http://jxnblk.com/react-component-permutations/demo
See the /demo folder.
MIT License
1.0.0-beta2
10 years ago
1.0.0-beta1
10 years ago