logo redirect to home fix
parent
8f7e562f4a
commit
2f12be405a
|
@ -1,4 +1,4 @@
|
||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect, useMemo } from "react";
|
||||||
import { makeStyles } from "@material-ui/core/styles";
|
import { makeStyles } from "@material-ui/core/styles";
|
||||||
import {
|
import {
|
||||||
Container,
|
Container,
|
||||||
|
@ -75,23 +75,20 @@ const ApplicationBar = () => {
|
||||||
setAnchorEl(null);
|
setAnchorEl(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getFlagsPath = () => {
|
const routePrefix = useMemo(() => process.env.PUBLIC_URL ?? "", [
|
||||||
const basePath = "/public/flags";
|
process.env.PUBLIC_URL
|
||||||
if (process.env.PUBLIC_URL) {
|
]);
|
||||||
return `${process.env.PUBLIC_URL}/${basePath}`;
|
|
||||||
} else {
|
const flagsPath = useMemo(() => `${routePrefix}/public/flags`, [routePrefix]);
|
||||||
return basePath;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.root}>
|
<div className={classes.root}>
|
||||||
<AppBar position="static">
|
<AppBar position="static">
|
||||||
<Toolbar>
|
<Toolbar>
|
||||||
<div className={classes.logo}>
|
<div className={classes.logo}>
|
||||||
<a href="/" className={classes.miniLogo}>
|
<a href={`${routePrefix}/`} className={classes.miniLogo}>
|
||||||
<img
|
<img
|
||||||
src={`${process.env.PUBLIC_URL ?? ""}/favicon.ico`}
|
src={`${routePrefix}/favicon.ico`}
|
||||||
alt="logo"
|
alt="logo"
|
||||||
className={classes.img}
|
className={classes.img}
|
||||||
/>
|
/>
|
||||||
|
@ -118,7 +115,7 @@ const ApplicationBar = () => {
|
||||||
format="png"
|
format="png"
|
||||||
pngSize={32}
|
pngSize={32}
|
||||||
shiny={true}
|
shiny={true}
|
||||||
basePath={getFlagsPath()}
|
basePath={flagsPath}
|
||||||
alt={flag.alt}
|
alt={flag.alt}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Reference in New Issue