diff --git a/src/components/Card/ExpandableCard.js b/src/components/Card/ExpandableCard.js new file mode 100644 index 0000000..408a14b --- /dev/null +++ b/src/components/Card/ExpandableCard.js @@ -0,0 +1,97 @@ +import React, { useState } from "react"; +import PropTypes from "prop-types"; +import styles from "./styles"; +import { makeStyles } from "@material-ui/core/styles"; +import { + Card, + CardHeader, + CardContent, + CardActions, + Collapse, + Avatar, + IconButton +} from "@material-ui/core"; +import clsx from "clsx"; +import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; + +const useStyles = makeStyles(styles); + +const ExpandableCard = ({ + Icon, + iconVariant, + title, + subtitle, + smallHeader, + expandable, + Summary, + Actions, + Content +}) => { + const [expanded, setExpanded] = useState(false); + + const classes = useStyles(); + + const handleExpandClick = () => { + setExpanded(!expanded); + }; + + return ( + + + {Icon} + + } + action={ + <> + {expandable && ( + + + + )} + + } + title={{title}} + subheader={subtitle} + /> + {Summary && {Summary}} + {Actions && {Actions}} + {expandable && Content && ( + + {Content} + + )} + + ); +}; + +ExpandableCard.defaultProps = { + expandable: true +}; + +ExpandableCard.propTypes = { + Icon: PropTypes.node.isRequired, + iconVariant: PropTypes.oneOf(["circle", "circular", "rounded", "square"]), + title: PropTypes.string.isRequired, + subtitle: PropTypes.string, + smallHeader: PropTypes.bool, + expandable: PropTypes.bool, + Summary: PropTypes.node, + Actions: PropTypes.node, + Content: PropTypes.node +}; + +export default ExpandableCard; diff --git a/src/components/Card/styles.js b/src/components/Card/styles.js new file mode 100644 index 0000000..82f52ca --- /dev/null +++ b/src/components/Card/styles.js @@ -0,0 +1,22 @@ +const styles = (theme) => ({ + expand: { + transform: "rotate(0deg)", + marginLeft: "auto", + transition: theme.transitions.create("transform", { + duration: theme.transitions.duration.shortest + }) + }, + expandOpen: { + transform: "rotate(180deg)" + }, + avatar: { + backgroundColor: theme.palette.primary.main + }, + avatarSmall: { + backgroundColor: theme.palette.primary.main, + width: theme.spacing(3), + height: theme.spacing(3) + } +}); + +export default styles; diff --git a/src/pages/settings/appearance/components/AppearancePage.js b/src/pages/settings/appearance/components/AppearancePage.js index 198e4a1..0a464aa 100644 --- a/src/pages/settings/appearance/components/AppearancePage.js +++ b/src/pages/settings/appearance/components/AppearancePage.js @@ -6,12 +6,13 @@ import PageTitle from "../../../../components/PageTitle"; import LanguageContainer from "./LanguageContainer"; import TextField from "@material-ui/core/TextField"; import Autocomplete from "@material-ui/lab/Autocomplete"; -import SaveIcon from "@material-ui/icons/Save"; +import { + Save as SaveIcon, + Vibration as VibrationIcon +} from "@material-ui/icons"; +import ExpandableCard from "../../../../components/Card/ExpandableCard"; const useStyles = makeStyles((theme) => ({ - root: { - minWidth: 275 - }, formControl: { margin: theme.spacing(1), width: 300 @@ -32,24 +33,31 @@ const AppearancePage = () => { return ( <> - - - -
- option} - className={classes.formControl} - renderInput={(params) => ( - - )} - /> -
- + + } + title={t("Forward.Options.KeyOverwrite.Label")} + subtitle={t("Forward.Options.KeyOverwrite.Tooltip")} + expandable={false} + Summary={ + <> + +
+ option} + className={classes.formControl} + renderInput={(params) => ( + + )} + /> + + } + Actions={ -
-
+ } + /> ); };