Cleaning Part 1
This commit is contained in:
1 parent
a1a931cdb7
commit
89f366ff35
9 files changed
-602
No files matched your search
@@ -1,30 +0,0 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { withStyles } from '@material-ui/core/styles';
|
||||
import Button from '@material-ui/core/Button';
|
||||
|
||||
const styles = theme => ({
|
||||
button: {
|
||||
margin: theme.spacing.unit,
|
||||
},
|
||||
input: {
|
||||
display: 'none',
|
||||
},
|
||||
});
|
||||
|
||||
function AddUserNextButton(props) {
|
||||
const { classes } = props;
|
||||
return (
|
||||
<div>
|
||||
<Button type="submit" variant="contained" color="primary" className={classes.button}>
|
||||
Next
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
AddUserNextButton.propTypes = {
|
||||
classes: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
export default withStyles(styles)(AddUserNextButton);
|
||||
@@ -1,13 +0,0 @@
|
||||
import React, { Component } from 'react'
|
||||
|
||||
class Callback extends Component {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
Authenticating...
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default Callback
|
||||
@@ -1,98 +0,0 @@
|
||||
import React, { Component } from 'react'
|
||||
import toRenderProps from 'recompose/toRenderProps'
|
||||
import withState from 'recompose/withState'
|
||||
import { Link } from 'react-router-dom'
|
||||
import {compose} from 'react-apollo'
|
||||
|
||||
// Materia UI
|
||||
|
||||
import { withStyles } from '@material-ui/core/styles'
|
||||
import Button from '@material-ui/core/Button'
|
||||
import Menu from '@material-ui/core/Menu'
|
||||
import MenuItem from '@material-ui/core/MenuItem'
|
||||
|
||||
// Images
|
||||
import GithubLogo from '../img/github-head-negative.png'
|
||||
import EmailIcon from '../img/email.png'
|
||||
import ProfileIcon from '@material-ui/icons/Person'
|
||||
import LogoutIcon from '@material-ui/icons/DirectionsWalk'
|
||||
|
||||
const UserLink = props => <Link to='/user' {...props} />
|
||||
const LogoutLink = props => <Link to='/logout' {...props} />
|
||||
|
||||
const WithState = toRenderProps(withState('anchorEl', 'updateAnchorEl', null))
|
||||
|
||||
const styles = {
|
||||
img: {
|
||||
margin: 20,
|
||||
display: 'block',
|
||||
maxWidth: 15,
|
||||
maxHeight: 15
|
||||
}
|
||||
}
|
||||
|
||||
class LoggedInUserMenu extends Component {
|
||||
|
||||
constructor (props) {
|
||||
super(props)
|
||||
this.state = {
|
||||
user: {}
|
||||
}
|
||||
}
|
||||
|
||||
displayIdentityProvider () {
|
||||
const { classes } = this.props
|
||||
switch (this.props.identityProvider) {
|
||||
case 'github':
|
||||
return (
|
||||
<img className={classes.img} src={GithubLogo} alt='Github' />
|
||||
)
|
||||
break
|
||||
case 'auth0':
|
||||
return (
|
||||
<img className={classes.img} src={EmailIcon} alt='Auth0' />
|
||||
)
|
||||
break
|
||||
default:
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
render () {
|
||||
const { classes } = this.props
|
||||
return (
|
||||
<WithState>
|
||||
{({ anchorEl, updateAnchorEl }) => {
|
||||
const open = Boolean(anchorEl)
|
||||
const handleClose = () => {
|
||||
updateAnchorEl(null)
|
||||
}
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Button
|
||||
aria-owns={open ? 'render-props-menu' : null}
|
||||
aria-haspopup='true'
|
||||
onClick={event => {
|
||||
updateAnchorEl(event.currentTarget)
|
||||
}}
|
||||
color='inherit'
|
||||
>
|
||||
{this.displayIdentityProvider()}
|
||||
{this.props.menuLabel}
|
||||
</Button>
|
||||
<Menu id='render-props-menu' anchorEl={anchorEl} open={open} onClose={handleClose}>
|
||||
<MenuItem onClick={handleClose} component={UserLink}><ProfileIcon /><div>Profile</div></MenuItem>
|
||||
<MenuItem onClick={handleClose} component={LogoutLink}><LogoutIcon /><div>Logout</div></MenuItem>
|
||||
</Menu>
|
||||
</React.Fragment>
|
||||
)
|
||||
}}
|
||||
</WithState>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withStyles(styles)
|
||||
)(LoggedInUserMenu)
|
||||
Reference in new issue
Block a user