Update Appbar with a new logo

This commit is contained in:
Ken Hibino 2021-04-19 06:56:00 -07:00
parent 948d0c761a
commit 72bcbadf72
9 changed files with 41 additions and 41 deletions

View File

@ -10,7 +10,6 @@ import List from "@material-ui/core/List";
import ListItem from "@material-ui/core/ListItem"; import ListItem from "@material-ui/core/ListItem";
import ListItemIcon from "@material-ui/core/ListItemIcon"; import ListItemIcon from "@material-ui/core/ListItemIcon";
import ListItemText from "@material-ui/core/ListItemText"; import ListItemText from "@material-ui/core/ListItemText";
import Typography from "@material-ui/core/Typography";
import Snackbar from "@material-ui/core/Snackbar"; import Snackbar from "@material-ui/core/Snackbar";
import SnackbarContent from "@material-ui/core/SnackbarContent"; import SnackbarContent from "@material-ui/core/SnackbarContent";
import IconButton from "@material-ui/core/IconButton"; import IconButton from "@material-ui/core/IconButton";
@ -26,7 +25,7 @@ import DoubleArrowIcon from "@material-ui/icons/DoubleArrow";
import CloseIcon from "@material-ui/icons/Close"; import CloseIcon from "@material-ui/icons/Close";
import { AppState } from "./store"; import { AppState } from "./store";
import { paths } from "./paths"; import { paths } from "./paths";
import { useTheme } from "./theme"; import { isDarkTheme, useTheme } from "./theme";
import { closeSnackbar } from "./actions/snackbarActions"; import { closeSnackbar } from "./actions/snackbarActions";
import { toggleDrawer } from "./actions/settingsActions"; import { toggleDrawer } from "./actions/settingsActions";
import ListItemLink from "./components/ListItemLink"; import ListItemLink from "./components/ListItemLink";
@ -37,6 +36,8 @@ import SettingsView from "./views/SettingsView";
import ServersView from "./views/ServersView"; import ServersView from "./views/ServersView";
import RedisInfoView from "./views/RedisInfoView"; import RedisInfoView from "./views/RedisInfoView";
import PageNotFoundView from "./views/PageNotFoundView"; import PageNotFoundView from "./views/PageNotFoundView";
import logo from "./images/logo-color.svg";
import logoWhite from "./images/logo-white.svg";
const drawerWidth = 220; const drawerWidth = 220;
@ -63,9 +64,7 @@ const useStyles = (theme: Theme) =>
zIndex: theme.zIndex.drawer + 1, zIndex: theme.zIndex.drawer + 1,
}, },
menuButton: { menuButton: {
marginRight: theme.spacing(2), color: isDarkTheme(theme)
color:
theme.palette.type === "dark"
? theme.palette.grey[100] ? theme.palette.grey[100]
: theme.palette.grey[700], : theme.palette.grey[700],
}, },
@ -173,15 +172,11 @@ function App(props: ConnectedProps<typeof connector>) {
> >
<MenuIcon /> <MenuIcon />
</IconButton> </IconButton>
<Typography <img
component="h1" src={isDarkTheme(theme) ? logoWhite : logo}
variant="h6" width={200}
noWrap alt="logo"
className={classes.title} />
color="textPrimary"
>
Asynq Monitoring
</Typography>
</Toolbar> </Toolbar>
</AppBar> </AppBar>
<div className={classes.mainContainer}> <div className={classes.mainContainer}>

View File

@ -10,6 +10,7 @@ import {
Link as RouterLink, Link as RouterLink,
LinkProps as RouterLinkProps, LinkProps as RouterLinkProps,
} from "react-router-dom"; } from "react-router-dom";
import { isDarkTheme } from "../theme";
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
listItem: { listItem: {
@ -17,21 +18,18 @@ const useStyles = makeStyles((theme) => ({
borderBottomRightRadius: "24px", borderBottomRightRadius: "24px",
}, },
selected: { selected: {
backgroundColor: backgroundColor: isDarkTheme(theme)
theme.palette.type === "dark"
? `${theme.palette.secondary.main}30` ? `${theme.palette.secondary.main}30`
: `${theme.palette.primary.main}30`, : `${theme.palette.primary.main}30`,
}, },
selectedText: { selectedText: {
fontWeight: 600, fontWeight: 600,
color: color: isDarkTheme(theme)
theme.palette.type === "dark"
? theme.palette.secondary.main ? theme.palette.secondary.main
: theme.palette.primary.main, : theme.palette.primary.main,
}, },
selectedIcon: { selectedIcon: {
color: color: isDarkTheme(theme)
theme.palette.type === "dark"
? theme.palette.secondary.main ? theme.palette.secondary.main
: theme.palette.primary.main, : theme.palette.primary.main,
}, },

View File

@ -7,11 +7,11 @@ import Menu from "@material-ui/core/Menu";
import MenuItem from "@material-ui/core/MenuItem"; import MenuItem from "@material-ui/core/MenuItem";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import { paths, queueDetailsPath } from "../paths"; import { paths, queueDetailsPath } from "../paths";
import { isDarkTheme } from "../theme";
const StyledBreadcrumb = withStyles((theme: Theme) => ({ const StyledBreadcrumb = withStyles((theme: Theme) => ({
root: { root: {
backgroundColor: backgroundColor: isDarkTheme(theme)
theme.palette.type === "dark"
? "#303030" ? "#303030"
: theme.palette.background.default, : theme.palette.background.default,
height: theme.spacing(3), height: theme.spacing(3),

View File

@ -9,6 +9,7 @@ import Paper from "@material-ui/core/Paper";
import Popper from "@material-ui/core/Popper"; import Popper from "@material-ui/core/Popper";
import MenuItem from "@material-ui/core/MenuItem"; import MenuItem from "@material-ui/core/MenuItem";
import MenuList from "@material-ui/core/MenuList"; import MenuList from "@material-ui/core/MenuList";
import { isDarkTheme } from "../theme";
interface Option { interface Option {
label: string; label: string;
@ -26,8 +27,7 @@ const useStyles = makeStyles((theme) => ({
zIndex: 2, zIndex: 2,
}, },
buttonContained: { buttonContained: {
backgroundColor: backgroundColor: isDarkTheme(theme)
theme.palette.type === "dark"
? "#303030" ? "#303030"
: theme.palette.background.default, : theme.palette.background.default,
color: theme.palette.text.primary, color: theme.palette.text.primary,

View File

@ -3,6 +3,7 @@ import { useTheme, Theme } from "@material-ui/core/styles";
import ReactSyntaxHighlighter from "react-syntax-highlighter"; import ReactSyntaxHighlighter from "react-syntax-highlighter";
import styleDark from "react-syntax-highlighter/dist/esm/styles/hljs/atom-one-dark"; import styleDark from "react-syntax-highlighter/dist/esm/styles/hljs/atom-one-dark";
import styleLight from "react-syntax-highlighter/dist/esm/styles/hljs/atom-one-light"; import styleLight from "react-syntax-highlighter/dist/esm/styles/hljs/atom-one-light";
import { isDarkTheme } from "../theme";
interface Props { interface Props {
language: string; language: string;
@ -13,7 +14,7 @@ interface Props {
// Theme aware syntax-highlighter component. // Theme aware syntax-highlighter component.
export default function SyntaxHighlighter(props: Props) { export default function SyntaxHighlighter(props: Props) {
const theme = useTheme<Theme>(); const theme = useTheme<Theme>();
const style = theme.palette.type === "dark" ? styleDark : styleLight; const style = isDarkTheme(theme) ? styleDark : styleLight;
return ( return (
<ReactSyntaxHighlighter <ReactSyntaxHighlighter
language={props.language} language={props.language}

View File

@ -13,6 +13,7 @@ import { useHistory } from "react-router-dom";
import { queueDetailsPath } from "../paths"; import { queueDetailsPath } from "../paths";
import { QueueInfo } from "../reducers/queuesReducer"; import { QueueInfo } from "../reducers/queuesReducer";
import { AppState } from "../store"; import { AppState } from "../store";
import { isDarkTheme } from "../theme";
interface TabPanelProps { interface TabPanelProps {
children?: React.ReactNode; children?: React.ReactNode;
@ -92,8 +93,7 @@ const useStyles = makeStyles((theme) => ({
taskcount: { taskcount: {
fontSize: "12px", fontSize: "12px",
color: theme.palette.text.secondary, color: theme.palette.text.secondary,
background: background: isDarkTheme(theme)
theme.palette.type === "dark"
? "#303030" ? "#303030"
: theme.palette.background.default, : theme.palette.background.default,
textAlign: "center", textAlign: "center",

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.6 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -25,3 +25,7 @@ export function useTheme(themePreference: ThemePreference): Theme {
}, },
}); });
} }
export function isDarkTheme(theme: Theme): boolean {
return theme.palette.type === "dark";
}