Created
March 27, 2019 00:27
-
-
Save Wicker25/3d8cff662992dd1b03b804d00a884462 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
export default class CreateUserModal extends React.Component { | |
render() { | |
const { isOpen, isLoading, errorMessage, onClose } = this.props; | |
if (isLoading) { | |
return <Spinner />; | |
} | |
return ( | |
<Modal show={isOpen} onClose={onClose}> | |
<Alert>{errorMessage}</Alert> | |
</Modal> | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import autobind from 'autobind-decorator'; | |
import React from 'react'; | |
import { inject, observer } from 'mobx-react'; | |
import CreateUserModal from './CreateUserModal'; | |
@inject('appStore') | |
@observer | |
export default class UserManagementPage extends React.Component { | |
@autobind | |
onCreateUserModalClosed() { | |
this.props.appStore.closeCreateUserModal(); | |
} | |
render() { | |
const { appStore } = this.props; | |
return ( | |
<div id="user-management-page"> | |
<Button onClick={appStore.openCreateUserModal}>Create User</Button> | |
<CreateUserModal | |
isOpen={appStore.isCreateUserModalOpen} | |
isLoading={appStore.isCreateUserModalLoading} | |
errorMessage={appStore.createUserModalErrorMessage} | |
onClose={this.onCreateUserModalClosed} | |
/> | |
{/* ... */} | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment