Formatting fixes

This commit is contained in:
Michael Thomas 2021-12-23 21:41:43 +00:00
parent c90f945430
commit 037fe88a3d
1 changed files with 21 additions and 21 deletions

View File

@ -5,41 +5,41 @@ import React from 'react';
import { Button, Modal, FocusableIframe } from '@wordpress/components';
class SelectDialog extends React.Component {
constructor(props) {
super(props);
constructor( props ) {
super( props );
this.state = {
isOpen: false
};
isOpen: false,
};
}
componentDidMount() {
window.addEventListener('message', this.handlePostMessage, false);
window.addEventListener( 'message', this.handlePostMessage, false );
}
componentWillUnmount() {
window.removeEventListener('message', this.handlePostMessage);
window.removeEventListener( 'message', this.handlePostMessage );
}
handlePostMessage = (event) => {
console.log('PostMessage recieved:', event.data);
this.props.onSelectForm(event.data);
handlePostMessage = ( event ) => {
console.log( 'PostMessage recieved:', event.data );
this.props.onSelectForm( event.data );
}
render() {
return (
<div>
<Button variant="primary" onClick={ () => this.setState({isOpen: true}) }>
<Button variant="primary" onClick={ () => this.setState( { isOpen: true } ) }>
Choose a form
</Button>
{ this.state.isOpen && (
<Modal title="Cognito Forms Embed" className="cognito-modal" onRequestClose={ () => this.setState({isOpen: false}) } shouldCloseOnClickOutside={ false }>
<FocusableIframe style={{ width: "500px", height: "500px" }} src="/wp-content/plugins/cognitoforms/testing/dialog.html"></FocusableIframe>
<Modal title="Cognito Forms Embed" className="cognito-modal" onRequestClose={ () => this.setState( { isOpen: false } ) } shouldCloseOnClickOutside={ false }>
<FocusableIframe style={ { width: '500px', height: '500px' } } src="/wp-content/plugins/cognitoforms/testing/dialog.html"></FocusableIframe>
</Modal>
) }
</div>
);
};
};
}
}
export default SelectDialog
export default SelectDialog;