From ebb4e11dac787bd55af2f3c5a3c6cf1ac34a634c Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Fri, 16 Jul 2021 14:21:36 -0400 Subject: [PATCH] Add actions prop to ItemTableAppBar to use ItemTableAppBarAction components --- .../ItemTableAppBar/ItemTableAppBar.js | 27 ++++++------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/src/components/ItemTableAppBar/ItemTableAppBar.js b/src/components/ItemTableAppBar/ItemTableAppBar.js index 86431ff..41dbec9 100644 --- a/src/components/ItemTableAppBar/ItemTableAppBar.js +++ b/src/components/ItemTableAppBar/ItemTableAppBar.js @@ -1,11 +1,10 @@ import React from "react"; import PropTypes from 'prop-types'; -import {makeStyles, Tooltip, Typography, AppBar, Toolbar, IconButton, Zoom, useTheme} from "@material-ui/core" -import DarkModeIcon from '@material-ui/icons/Brightness4'; -import LightModeIcon from '@material-ui/icons/Brightness7'; +import {makeStyles, Typography, AppBar, Toolbar, useTheme} from "@material-ui/core" +import ItemTableAppBarAction from "../ItemTableAppBarAction"; -export default function ItemTableAppBar({ title, setDarkMode }){ +export default function ItemTableAppBar({ title, actions }){ const theme = useTheme(); const useStyles = makeStyles((theme) => ({ @@ -17,9 +16,6 @@ export default function ItemTableAppBar({ title, setDarkMode }){ }, })); const classes = useStyles(theme); - const darkMode = theme.palette.type === "dark" - - const toggleDarkMode = () => setDarkMode(!darkMode); return( <> @@ -29,15 +25,7 @@ export default function ItemTableAppBar({ title, setDarkMode }){ {title} - - - {darkMode ? : } - - + {actions} @@ -47,10 +35,11 @@ export default function ItemTableAppBar({ title, setDarkMode }){ ItemTableAppBar.propTypes = { /** The title of the app bar. */ "title": PropTypes.string, - /** Function to toggle darkMode. */ - "setDarkMode": PropTypes.func.isRequired, + /** Array of ItemTableAppBarActions. */ + "actions": PropTypes.arrayOf(ItemTableAppBarAction), }; ItemTableAppBar.defaultProps = { - "title": "" + "title": "", + "actions": [] }; \ No newline at end of file