Files
WhatToWatch/client/src/components/MediaModal.js
2019-04-07 09:44:12 -05:00

112 lines
3.1 KiB
JavaScript

import React from 'react';
import {withStyles} from '@material-ui/core/styles';
import Button from '@material-ui/core/Button';
import Dialog from '@material-ui/core/Dialog';
import MuiDialogTitle from '@material-ui/core/DialogTitle';
import MuiDialogContent from '@material-ui/core/DialogContent';
import MuiDialogActions from '@material-ui/core/DialogActions';
import IconButton from '@material-ui/core/IconButton';
import CloseIcon from '@material-ui/icons/Close';
import Typography from '@material-ui/core/Typography';
const DialogTitle = withStyles(theme => ({
root: {
borderBottom: `1px solid ${theme.palette.divider}`,
margin: 0,
padding: theme.spacing.unit * 2,
},
closeButton: {
position: 'absolute',
right: theme.spacing.unit,
top: theme.spacing.unit,
color: theme.palette.grey[500],
},
}))(props => {
const {children, classes, onClose} = props;
return (
<MuiDialogTitle disableTypography className={classes.root}>
<Typography variant="h6">{children}</Typography>
{onClose ? (
<IconButton
aria-label="Close"
className={classes.closeButton}
onClick={onClose}
>
<CloseIcon />
</IconButton>
) : null}
</MuiDialogTitle>
);
});
const DialogContent = withStyles(theme => ({
root: {
margin: 0,
padding: theme.spacing.unit * 2,
},
}))(MuiDialogContent);
const DialogActions = withStyles(theme => ({
root: {
borderTop: `1px solid ${theme.palette.divider}`,
margin: 0,
padding: theme.spacing.unit,
},
}))(MuiDialogActions);
class CustomizedDialogDemo extends React.Component {
state = {
open: false,
};
handleClickOpen = () => {
this.setState({
open: true,
});
};
handleClose = () => {
this.setState({open: false});
};
render() {
return (
<div>
<button
className="btn-small waves-effect waves-light center-align"
onClick={this.handleClickOpen}
name="action"
>
<i className="material-icons right">info</i>
Info
</button>
<Dialog
onClose={this.handleClose}
aria-labelledby="customized-dialog-title"
open={this.state.open}
>
<DialogTitle id="customized-dialog-title" onClose={this.handleClose}>
What do we do with this info?
</DialogTitle>
<DialogContent>
<Typography gutterBottom>
We need to make a request to fetch a token which will allow us to
get a list of your most watched media. We will never store your
Plex password or make any changes to your Plex server. This is an
open source project and you can view the code&nbsp;
<a href="https://github.com/mjrode/recommend"> here.</a>
</Typography>
</DialogContent>
<DialogActions>
<Button onClick={this.handleClose} color="primary">
Ok
</Button>
</DialogActions>
</Dialog>
</div>
);
}
}
export default CustomizedDialogDemo;