2016-09-19 23:43:35 +00:00
|
|
|
import React, { Component, PropTypes } from 'react';
|
2016-10-19 20:22:18 +00:00
|
|
|
|
2016-09-19 23:43:35 +00:00
|
|
|
import componentStyles from './styles';
|
2016-10-03 17:54:22 +00:00
|
|
|
import Button from '../../buttons/Button';
|
2016-09-19 23:43:35 +00:00
|
|
|
|
|
|
|
class LogoutForm extends Component {
|
|
|
|
static propTypes = {
|
|
|
|
onSubmit: PropTypes.func,
|
|
|
|
user: PropTypes.object,
|
|
|
|
};
|
|
|
|
|
|
|
|
onFormSubmit = (evt) => {
|
|
|
|
evt.preventDefault();
|
|
|
|
|
|
|
|
const { onSubmit } = this.props;
|
|
|
|
|
|
|
|
return onSubmit();
|
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
const {
|
|
|
|
avatarStyles,
|
|
|
|
containerStyles,
|
|
|
|
formStyles,
|
|
|
|
submitButtonStyles,
|
|
|
|
subtextStyles,
|
|
|
|
usernameStyles,
|
|
|
|
} = componentStyles;
|
|
|
|
const { user } = this.props;
|
|
|
|
const { gravatarURL } = user;
|
|
|
|
const { onFormSubmit } = this;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<form onSubmit={onFormSubmit} style={formStyles}>
|
|
|
|
<div style={containerStyles}>
|
|
|
|
<img alt="Avatar" src={gravatarURL} style={avatarStyles} />
|
|
|
|
<p style={usernameStyles}>{user.username}</p>
|
|
|
|
<p style={subtextStyles}>Are you sure you want to log out?</p>
|
|
|
|
</div>
|
2016-10-03 17:54:22 +00:00
|
|
|
<Button
|
2016-09-19 23:43:35 +00:00
|
|
|
onClick={onFormSubmit}
|
|
|
|
style={submitButtonStyles}
|
|
|
|
text="Logout"
|
|
|
|
type="submit"
|
2016-10-03 17:54:22 +00:00
|
|
|
variant="gradient"
|
2016-09-19 23:43:35 +00:00
|
|
|
/>
|
|
|
|
</form>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default LogoutForm;
|