diff --git a/src/components/AppShell.jsx b/src/components/AppShell.jsx index 1545d58..d94a5f4 100644 --- a/src/components/AppShell.jsx +++ b/src/components/AppShell.jsx @@ -1,4 +1,4 @@ -import { PureComponent } from 'react'; +import { PureComponent, lazy, Suspense } from 'react'; import Box from '@mui/material/Box'; import List from '@mui/material/List'; import ListItemButton from '@mui/material/ListItemButton'; @@ -21,6 +21,10 @@ import { } from '../colors'; import { ChatFab, ChatDrawer } from './chat'; +const BreakpointOverlay = import.meta.env.DEV + ? lazy(() => import('./BreakpointOverlay')) + : null; + const SIDEBAR_WIDTH = 144; const SUB_NAV_WIDTH = 88; @@ -322,6 +326,11 @@ export default function AppShell() { + {BreakpointOverlay && ( + + + + )} ); } diff --git a/src/components/BreakpointOverlay.jsx b/src/components/BreakpointOverlay.jsx new file mode 100644 index 0000000..07f8912 --- /dev/null +++ b/src/components/BreakpointOverlay.jsx @@ -0,0 +1,72 @@ +import { useMemo } from 'react'; +import Box from '@mui/material/Box'; +import { useTheme } from '@mui/material/styles'; + +export default function BreakpointOverlay() { + if (!import.meta.env.DEV) { + return null; + } + + const theme = useTheme(); + + const breakpoints = useMemo(() => { + const values = theme?.breakpoints?.values || {}; + return [ + { name: 'xs', width: values.xs || 360, color: 'rgba(239, 68, 68, 0.75)' }, + { name: 'sm', width: values.sm || 600, color: 'rgba(245, 158, 11, 0.75)' }, + { name: 'md', width: values.md || 900, color: 'rgba(16, 185, 129, 0.75)' }, + { name: 'lg', width: values.lg || 1200, color: 'rgba(14, 165, 233, 0.75)' }, + { name: 'xl', width: values.xl || 1536, color: 'rgba(168, 85, 247, 0.75)' }, + ]; + }, [theme]); + + return ( + + {breakpoints.map((bp) => ( + + + {bp.name} + + + ))} + + ); +}