Skip to content

Commit

Permalink
add icon
Browse files Browse the repository at this point in the history
  • Loading branch information
shiburagi committed Jan 14, 2019
1 parent 08a2e29 commit caea636
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/components/Snackbar/SnackbarContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ const variantIcon = {
};

const useStyles = makeStyles(theme => ({
root:{
display:"flex"
},
success: {
backgroundColor: green[600],
},
Expand Down Expand Up @@ -55,6 +58,9 @@ const useStyles = makeStyles(theme => ({
opacity: 0.9,
marginRight: theme.spacing.unit,
},
snackbarMessage:{
flex:1
},
message: {
display: 'flex',
alignItems: 'center',
Expand All @@ -67,7 +73,12 @@ function MySnackbarContent({ className, message, icon, onClose, variant, ...othe

return (
<SnackbarContent
className={classNames(classes[variant], className)}
className={classNames(classes.root,classes[variant], className)}
classes={
{
message:classes.snackbarMessage
}
}
aria-describedby="client-snackbar"
message={
<span id="client-snackbar" className={classes.message}>
Expand Down
9 changes: 8 additions & 1 deletion src/views/Notification/Notification.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Snackbar from '@material-ui/core/Snackbar';
import { makeStyles } from '@material-ui/styles';
import { Grid } from '../../../node_modules/@material-ui/core';
import SnackbarContent from "../../components/Snackbar/SnackbarContent";
import NotificationIcon from "@material-ui/icons/Notifications"

const useStyles2 = makeStyles(theme => ({
margin: {
Expand All @@ -17,7 +18,7 @@ function Notification() {
const [open, setOpen] = React.useState(false);
const [variant, setVariant] = React.useState();

const handleClick=(variant)=>()=> {
const handleClick = (variant) => () => {
setOpen(true);
setVariant(variant);
}
Expand Down Expand Up @@ -85,6 +86,12 @@ function Notification() {
className={classes.margin}
message="I love candy. I love cookies. I love cupcakes. I love cheesecake. I love chocolate."
/>
<SnackbarContent
icon={NotificationIcon}
variant="inverse"
className={classes.margin}
message="I love candy. I love cookies. I love cupcakes. I love cheesecake. I love chocolate."
/>

</Grid>
</Grid>
Expand Down

0 comments on commit caea636

Please sign in to comment.