diff options
author | Anton Tananaev <anton@traccar.org> | 2023-08-19 13:58:45 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-08-19 13:59:07 -0700 |
commit | d3c7705bedebd65c94f9eea691aaf2fe03b0cafe (patch) | |
tree | 5f98b3d9bbbd4fe8067b5a334e84aff008b8db22 /modern/src/login/LogoImage.jsx | |
parent | 0161ae449d4a7bd0781c0665d663353663ab0faf (diff) | |
download | trackermap-web-d3c7705bedebd65c94f9eea691aaf2fe03b0cafe.tar.gz trackermap-web-d3c7705bedebd65c94f9eea691aaf2fe03b0cafe.tar.bz2 trackermap-web-d3c7705bedebd65c94f9eea691aaf2fe03b0cafe.zip |
Move to Vite
Diffstat (limited to 'modern/src/login/LogoImage.jsx')
-rw-r--r-- | modern/src/login/LogoImage.jsx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/modern/src/login/LogoImage.jsx b/modern/src/login/LogoImage.jsx new file mode 100644 index 00000000..f4c7969c --- /dev/null +++ b/modern/src/login/LogoImage.jsx @@ -0,0 +1,35 @@ +import React from 'react'; +import { useTheme, useMediaQuery } from '@mui/material'; +import { useSelector } from 'react-redux'; +import { makeStyles } from '@mui/styles'; +import { ReactComponent as Logo } from '../resources/images/logo.svg'; + +const useStyles = makeStyles(() => ({ + image: { + alignSelf: 'center', + maxWidth: '240px', + maxHeight: '120px', + width: 'auto', + height: 'auto', + }, +})); + +const LogoImage = ({ color }) => { + const theme = useTheme(); + const classes = useStyles(); + + const expanded = !useMediaQuery(theme.breakpoints.down('lg')); + + const logo = useSelector((state) => state.session.server.attributes?.logo); + const logoInverted = useSelector((state) => state.session.server.attributes?.logoInverted); + + if (logo) { + if (expanded && logoInverted) { + return <img className={classes.image} src={logoInverted} alt="" />; + } + return <img className={classes.image} src={logo} alt="" />; + } + return <Logo className={classes.image} style={{ color }} />; +}; + +export default LogoImage; |