diff --git a/src/App.tsx b/src/App.tsx index 995480ba1..2bdbeb087 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,6 +1,6 @@ import React, { useEffect } from "react" -import Container from "@mui/material/Container" +import Container, { ContainerProps } from "@mui/material/Container" import CssBaseline from "@mui/material/CssBaseline" import { styled } from "@mui/material/styles" import { makeStyles } from "@mui/styles" @@ -44,7 +44,7 @@ const useStyles = makeStyles(theme => ({ }, })) -const LoginContent = styled(Container)(() => ({ +const LoginContent: React.FC = styled(Container)(() => ({ padding: 0, margin: 0, width: "100%", diff --git a/src/components/ErrorPageContainer.tsx b/src/components/ErrorPageContainer.tsx index c885515f5..59303bf8f 100644 --- a/src/components/ErrorPageContainer.tsx +++ b/src/components/ErrorPageContainer.tsx @@ -36,14 +36,16 @@ const useStyles = makeStyles((theme: any) => ({ margin: "1vh auto", }, errorTitle: { - backgroundColor: (props: ErrorTypeProps) => - props.errorType === "warning" ? theme.errors.yellowErrorBackground : theme.errors.redErrorBackground, - color: (props: ErrorTypeProps) => - props.errorType === "warning" ? theme.errors.yellowErrorText : theme.errors.redErrorText, + color: theme.palette.common.black, + backgroundColor: theme.palette.common.white, + border: (props: ErrorTypeProps) => + props.errorType === "warning" + ? `1px solid ${theme.palette.warning.main}` + : `1px solid ${theme.palette.error.main}`, }, errorIcon: { color: (props: ErrorTypeProps) => - props.errorType === "warning" ? theme.errors.yellowErrorText : theme.errors.redErrorText, + props.errorType === "warning" ? theme.palette.warning.main : theme.palette.error.main, }, })) diff --git a/src/components/Nav.js b/src/components/Nav.tsx similarity index 91% rename from src/components/Nav.js rename to src/components/Nav.tsx index dc75cd6c4..4c2383bc7 100644 --- a/src/components/Nav.js +++ b/src/components/Nav.tsx @@ -1,4 +1,3 @@ -//@flow import React, { useState } from "react" import HomeIcon from "@mui/icons-material/Home" @@ -12,8 +11,7 @@ import { styled } from "@mui/material/styles" import Toolbar from "@mui/material/Toolbar" import Typography from "@mui/material/Typography" import { makeStyles } from "@mui/styles" -import i18n from "i18next" -import { useDispatch, useSelector } from "react-redux" +import * as i18n from "i18next" import { Link as RouterLink, useLocation, useNavigate } from "react-router-dom" import logo from "../images/csc_logo.svg" @@ -23,6 +21,7 @@ import { setLocale } from "features/localeSlice" import { resetUser } from "features/userSlice" import { resetObjectType } from "features/wizardObjectTypeSlice" import { resetFolder } from "features/wizardSubmissionFolderSlice" +import { useAppSelector, useAppDispatch } from "hooks" import { pathWithLocale } from "utils" const useStyles = makeStyles(theme => ({ @@ -56,14 +55,13 @@ const ServiceTitle = styled(Typography)(({ theme }) => ({ })) type MenuItemProps = { - currentLocale: string, + currentLocale: string } const NavigationLinks = (props: MenuItemProps) => { const { currentLocale } = props - const classes = useStyles() - const dispatch = useDispatch() + const dispatch = useAppDispatch() const resetWizard = () => { dispatch(resetObjectType()) @@ -75,7 +73,6 @@ const NavigationLinks = (props: MenuItemProps) => { { const [anchorEl, setAnchorEl] = useState(null) const open = Boolean(anchorEl) - - const dispatch = useDispatch() + const dispatch = useAppDispatch() const navigate = useNavigate() @@ -176,21 +172,18 @@ const LanguageSelector = (props: MenuItemProps) => { } const NavigationMenu = () => { - const classes = useStyles() - - let location = useLocation() - - const currentLocale = useSelector(state => state.locale) || Locale.defaultLocale + const location = useLocation() + const currentLocale = useAppSelector(state => state.locale) || Locale.defaultLocale return ( -