|
| 1 | +import React from 'react'; |
| 2 | +import Grid from '@material-ui/core/Grid'; |
| 3 | +import Typography from '@material-ui/core/Typography'; |
| 4 | +import { makeStyles, useTheme, rgbToHex } from '@material-ui/core/styles'; |
| 5 | + |
| 6 | +const useStyles = makeStyles(theme => ({ |
| 7 | + root: { |
| 8 | + width: '100%', |
| 9 | + maxWidth: 600, |
| 10 | + }, |
| 11 | + group: { |
| 12 | + marginTop: theme.spacing(3), |
| 13 | + }, |
| 14 | + color: { |
| 15 | + display: 'flex', |
| 16 | + alignItems: 'center', |
| 17 | + '& div:first-of-type': { |
| 18 | + width: theme.spacing(6), |
| 19 | + height: theme.spacing(6), |
| 20 | + marginRight: theme.spacing(1), |
| 21 | + borderRadius: theme.shape.borderRadius, |
| 22 | + }, |
| 23 | + }, |
| 24 | +})); |
| 25 | + |
| 26 | +export default function Intentions() { |
| 27 | + const classes = useStyles(); |
| 28 | + const theme = useTheme(); |
| 29 | + |
| 30 | + const item = (color, name) => ( |
| 31 | + <Grid item xs={6} sm={4} className={classes.color}> |
| 32 | + <div style={{ backgroundColor: color }} /> |
| 33 | + <div> |
| 34 | + <Typography variant="body2">{name}</Typography> |
| 35 | + <Typography variant="body2" color="textSecondary"> |
| 36 | + {rgbToHex(color)} |
| 37 | + </Typography> |
| 38 | + </div> |
| 39 | + </Grid> |
| 40 | + ); |
| 41 | + |
| 42 | + return ( |
| 43 | + <div className={classes.root}> |
| 44 | + <Typography gutterBottom className={classes.group}> |
| 45 | + Primary |
| 46 | + </Typography> |
| 47 | + <Grid container spacing={1}> |
| 48 | + {item(theme.palette.primary.light, 'light')} |
| 49 | + {item(theme.palette.primary.main, 'main')} |
| 50 | + {item(theme.palette.primary.dark, 'dark')} |
| 51 | + </Grid> |
| 52 | + <Typography gutterBottom className={classes.group}> |
| 53 | + Secondary |
| 54 | + </Typography> |
| 55 | + <Grid container spacing={1}> |
| 56 | + {item(theme.palette.secondary.light, 'light')} |
| 57 | + {item(theme.palette.secondary.main, 'main')} |
| 58 | + {item(theme.palette.secondary.dark, 'dark')} |
| 59 | + </Grid> |
| 60 | + <Typography gutterBottom className={classes.group}> |
| 61 | + Error |
| 62 | + </Typography> |
| 63 | + <Grid container spacing={1}> |
| 64 | + {item(theme.palette.error.light, 'light')} |
| 65 | + {item(theme.palette.error.main, 'main')} |
| 66 | + {item(theme.palette.error.dark, 'dark')} |
| 67 | + </Grid> |
| 68 | + <Typography gutterBottom className={classes.group}> |
| 69 | + Warning |
| 70 | + </Typography> |
| 71 | + <Grid container spacing={1}> |
| 72 | + {item(theme.palette.warning.light, 'light')} |
| 73 | + {item(theme.palette.warning.main, 'main')} |
| 74 | + {item(theme.palette.warning.dark, 'dark')} |
| 75 | + </Grid> |
| 76 | + <Typography gutterBottom className={classes.group}> |
| 77 | + Info |
| 78 | + </Typography> |
| 79 | + <Grid container spacing={1}> |
| 80 | + {item(theme.palette.info.light, 'light')} |
| 81 | + {item(theme.palette.info.main, 'main')} |
| 82 | + {item(theme.palette.info.dark, 'dark')} |
| 83 | + </Grid> |
| 84 | + <Typography gutterBottom className={classes.group}> |
| 85 | + Success |
| 86 | + </Typography> |
| 87 | + <Grid container spacing={1}> |
| 88 | + {item(theme.palette.success.light, 'light')} |
| 89 | + {item(theme.palette.success.main, 'main')} |
| 90 | + {item(theme.palette.success.dark, 'dark')} |
| 91 | + </Grid> |
| 92 | + </div> |
| 93 | + ); |
| 94 | +} |
0 commit comments