Under development
React.Component extension for use with patternlab-react
npm install patternlab-react
import React from 'react';
import { PatternLabComponent } from '@peteyg/patternlab-react-component';
export default class MyComponent extends PatternLabComponent {
render() {
return (
<div>
MyComponent
</div>
)
}
}
import React from 'react';
import { PatternLabComponent } from '@peteyg/patternlab-react-component';
class MyComponent extends PatternLabComponent {
static getTitle() {
return "Foo";
}
static getDescription() {
return "Bar";
}
render() {
return (
<div>
{this.props.myProp}
</div>
)
}
}
MyComponent.propTypes = {
myProp: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.object
])
}
MyComponent.describePropTypes = {
myProp: {
type: "oneOfType(string, object)",
isRequired: true
}
}
MyComponent.fakeProps = {
myProp: "Lorem ipsum"
}
export default MyComponent
- getTitle()
- getDescription()
Currently some propTypes are not discoverable so need to be described. Hopefully deprecate this in the future.
Set prop values that will only be displayed in the style guide. Useful for required props that have no default value.