Initial Activity View

Add New Colors.jsx
Allow Dark model Toggle from the Navbar
This commit is contained in:
Mo Tarbin 2024-12-28 18:52:06 -05:00
parent 4fc836a34b
commit d4c36e2057
17 changed files with 1326 additions and 310 deletions

View file

@ -0,0 +1,51 @@
import useStickyState from '@/hooks/useStickyState'
import {
BrightnessAuto,
DarkModeOutlined,
LightModeOutlined,
} from '@mui/icons-material'
import { FormControl, IconButton, useColorScheme } from '@mui/joy'
const ELEMENTID = 'select-theme-mode'
const ThemeToggleButton = ({ sx }) => {
const { mode, setMode } = useColorScheme()
const [themeMode, setThemeMode] = useStickyState(mode, 'themeMode')
const handleThemeModeChange = e => {
e.preventDefault()
e.stopPropagation()
let newThemeMode
switch (themeMode) {
case 'light':
newThemeMode = 'dark'
break
case 'dark':
newThemeMode = 'system'
break
case 'system':
default:
newThemeMode = 'light'
break
}
setThemeMode(newThemeMode)
setMode(newThemeMode)
}
return (
<FormControl sx={sx}>
<IconButton onClick={handleThemeModeChange}>
{themeMode === 'light' ? (
<DarkModeOutlined />
) : themeMode === 'dark' ? (
<BrightnessAuto />
) : (
<LightModeOutlined />
)}
</IconButton>
</FormControl>
)
}
export default ThemeToggleButton