import React from 'react'; import Examples from './utils/Examples.js'; import Button from '../../src/react/Button.js'; import Modal from '../../src/react/Modal.js'; import Input from '../../src/react/Input.js'; import HTMLStandardModal from '../../components/modal/standard-modal.html'; import HTMLAlertModal from '../../components/modal/alert-modal.html'; import HTMLErrorModal from '../../components/modal/error-modal.html'; import HTMLCustomModal from '../../components/modal/custom-modal.html'; class Example extends React.Component { constructor(props) { super(props); this.state = { show: false }; } render() { const { children } = this.props; const { show } = this.state; var childrenWithProps = React.Children.map(children, child => { let childChildrenWithProps = []; if (child.props.children) { let childChildren = child.props.children; childChildrenWithProps = React.Children.map(childChildren, child => React.cloneElement(child, { onClose: ()=>this.setState({show: !show}) })); } return React.cloneElement(child, { show: this.state.show, onClose: ()=>this.setState({show: !show}), children: childChildrenWithProps}); } ); return (