1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/frontend/src/component/user/user-component.jsx

71 lines
2.0 KiB
React
Raw Normal View History

import React, { PropTypes } from 'react';
import { Textfield, Button } from 'react-mdl';
import Modal from 'react-modal';
const customStyles = {
overlay: {
position: 'fixed',
top: 0,
left: 0,
right: 0,
bottom: 0,
backgroundColor: 'rgba(0, 0, 0, 0.75)',
zIndex: 99999,
},
content: {
top: '50%',
left: '50%',
right: 'auto',
bottom: 'auto',
marginRight: '-50%',
transform: 'translate(-50%, -50%)',
backgroundColor: '#FFFFFF',
},
};
2016-11-25 15:37:06 +01:00
class EditUserComponent extends React.Component {
static propTypes () {
return {
user: PropTypes.object.isRequired,
updateUserName: PropTypes.func.isRequired,
2016-12-20 19:28:45 +01:00
save: PropTypes.func.isRequired,
};
}
handleSubmit = (evt) => {
evt.preventDefault();
this.props.save();
}
render () {
return (
2016-12-04 11:56:41 +01:00
<div>
<Modal
isOpen={this.props.user.showDialog}
contentLabel="test"
style={customStyles} >
<h2>Action required</h2>
<div>
2016-12-04 11:56:41 +01:00
<p>
2016-12-27 13:11:04 +01:00
You have to specify a username to use Unleash. This will allow us to track your changes.
2016-12-04 11:56:41 +01:00
</p>
<form onSubmit={this.handleSubmit}>
<Textfield
label="Username"
2016-12-04 11:56:41 +01:00
name="username"
required
value={this.props.user.userName}
onChange={(e) => this.props.updateUserName(e.target.value)}
/>
<br />
2016-12-27 13:11:04 +01:00
<Button raised accent>Save</Button>
2016-12-04 11:56:41 +01:00
</form>
</div>
</Modal>
2016-12-04 11:56:41 +01:00
</div>
);
}
}
2016-11-25 15:37:06 +01:00
export default EditUserComponent;