aboutsummaryrefslogtreecommitdiff
path: root/modern/src/login/LogoImage.jsx
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-08-19 13:58:45 -0700
committerAnton Tananaev <anton@traccar.org>2023-08-19 13:59:07 -0700
commitd3c7705bedebd65c94f9eea691aaf2fe03b0cafe (patch)
tree5f98b3d9bbbd4fe8067b5a334e84aff008b8db22 /modern/src/login/LogoImage.jsx
parent0161ae449d4a7bd0781c0665d663353663ab0faf (diff)
downloadtrackermap-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.jsx35
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;