export default class extends Component {
constructor(props) {
super(props);
this.state = {
isOpen: false
};
}
handleSubmit (e) {
e.preventDefault();
}
showTradeModal = () => {
this.setState({ isOpen: true });
}
closeTradeModal = () => {
this.setState({ isOpen: false });
}
render() {
return (
<Modal isOpen={this.state.isOpen} style={tradeOptions}>
<h2 ref={subtitle => this.subtitle = subtitle}>Hello</h2>
<div>I am a modal</div>
<form onSubmit={this.handleSubmit}>
<input />
<button>tab navigation</button>
<button>stays</button>
<button>inside</button>
<button>the modal</button>
</form>
<button onClick={this.props.buyCurrency}>Confirm</button>
<button onClick={this.closeTradeModal}>Cancel</button>
</Modal>
);
}
}
class Container extends React.Component {
state = {
showModal: false
}
handleModal = () => {
this.setState({showModal: !this.state.showModal});
}
render() {
return (
<Fragment>
{ this.state.showModal && <MyModal handleModal={this.handleModal}/> }
<button onClick={this.handleModal}> Show modal </button>
</Fragment>
)
}