mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 09:18:59 +00:00
ee3d96eb53
* Updates eslint packages * Expected parentheses around arrow function argument having a body with curly braces * Prop type `object` is forbidden * Visible, non-interactive elements should not have mouse or keyboard event listeners * Prop type is defined but not used * Unexpected use of file extension "jsx" * Expected 'this' to be used by class method * HTML entities must be escaped * Prevent default behavior on more options button click
54 lines
1.2 KiB
JavaScript
54 lines
1.2 KiB
JavaScript
import React, { Component, PropTypes } from 'react';
|
|
|
|
import componentStyles from './styles';
|
|
import Button from '../../buttons/Button';
|
|
import userInterface from '../../../interfaces/user';
|
|
|
|
class LogoutForm extends Component {
|
|
static propTypes = {
|
|
onSubmit: PropTypes.func,
|
|
user: userInterface,
|
|
};
|
|
|
|
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>
|
|
<Button
|
|
onClick={onFormSubmit}
|
|
style={submitButtonStyles}
|
|
text="Logout"
|
|
type="submit"
|
|
variant="gradient"
|
|
/>
|
|
</form>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default LogoutForm;
|