Skip to content

Commit

Permalink
chore: add mui-consistent alert bar
Browse files Browse the repository at this point in the history
  • Loading branch information
CSharperMantle committed Jul 12, 2023
1 parent 092ea50 commit 72edeac
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
37 changes: 37 additions & 0 deletions src/components/CommonLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,45 @@ import { graphql, useStaticQuery } from "gatsby"
import { SnackbarProvider } from "notistack"
import React from "react"
import { Provider as ReduxProvider } from "react-redux"
import {} from "lodash"

import Box from "@mui/material/Box"
import CssBaseline from "@mui/material/CssBaseline"
import { StyledEngineProvider } from "@mui/material/styles"
import ThemeProvider from "@mui/material/styles/ThemeProvider"
import Alert from "@mui/material/Alert"

import { theme } from "../ThemeOptions"
import { appStore } from "../viewmodel"

// eslint-disable-next-line @typescript-eslint/no-explicit-any, react/display-name
const InfoAlert = React.forwardRef(({ message }: any, ref: any) => (
<Alert severity="info" variant="filled" ref={ref}>
{message}
</Alert>
))

// eslint-disable-next-line @typescript-eslint/no-explicit-any, react/display-name
const ErrorAlert = React.forwardRef(({ message }: any, ref: any) => (
<Alert severity="error" variant="filled" ref={ref}>
{message}
</Alert>
))

// eslint-disable-next-line @typescript-eslint/no-explicit-any, react/display-name
const WarningAlert = React.forwardRef(({ message }: any, ref: any) => (
<Alert severity="warning" variant="filled" ref={ref}>
{message}
</Alert>
))

// eslint-disable-next-line @typescript-eslint/no-explicit-any, react/display-name
const SuccessAlert = React.forwardRef(({ message }: any, ref: any) => (
<Alert severity="success" variant="filled" ref={ref}>
{message}
</Alert>
))

export interface ICommonPageLayoutProps {
readonly children: React.ReactNode
}
Expand All @@ -37,6 +67,13 @@ export const CommonPageLayout = ({ children }: ICommonPageLayoutProps) => {
<StyledEngineProvider injectFirst>
<ThemeProvider theme={theme}>
<SnackbarProvider
Components={{
default: InfoAlert,
error: ErrorAlert,
warning: WarningAlert,
success: SuccessAlert,
info: InfoAlert,
}}
anchorOrigin={{
vertical: "bottom",
horizontal: "center",
Expand Down
2 changes: 1 addition & 1 deletion src/components/gameControlBackdrop/GameControlBackdrop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export const GameControlBackdrop = (props: IGameStatusBackdropProps) => {
>
{content}
<Fade in={isPortrait}>
<Typography align="center" variant="body1" paragraph>
<Typography align="center" variant="body1" paragraph color="yellow">
<strong>{t("typ_p_portrait")}</strong>
</Typography>
</Fade>
Expand Down

1 comment on commit 72edeac

@vercel
Copy link

@vercel vercel bot commented on 72edeac Jul 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.