UNPKG

fk-react-ui-components

Version:

Step 1 : Create a file in [ Seeds / Plants / Trees ] <br> Step 2 : It should export an Object with component name and story Component [Refer other components] <br> Step 3 : Story Component should return a react component <br> Step 3 : Created file should

37 lines (31 loc) 912 B
import React from 'react'; import PropTypes from 'prop-types'; import { Controls } from './styles/index'; export default class NavButton extends React.Component { constructor(props) { super(props); this.clickHandler = this.clickHandler.bind(this); } clickHandler() { this.props.moveCarousel(this.props.direction); } render() { const items = React.Children.map(this.props.children, child => React.cloneElement(child, { onClick: this.clickHandler })); return React.createElement( Controls, { direction: this.props.direction }, items ); } } NavButton.propTypes = { moveCarousel: PropTypes.func, direction: PropTypes.string.isRequired, children: PropTypes.element.isRequired }; NavButton.defaultProps = { moveCarousel: f => f }; //# sourceMappingURL=NavButton.js.map