generated from RENCI/react-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleanup
- Loading branch information
Showing
9 changed files
with
260 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
import { IconButton, Stack, Typography } from '@mui/joy'; | ||
import { | ||
DarkMode as OnIcon, | ||
LightMode as OffIcon, | ||
} from '@mui/icons-material'; | ||
import { useSettings } from '@context'; | ||
|
||
export const DarkModeToggle = () => { | ||
const { darkMode } = useSettings(); | ||
|
||
return ( | ||
<Stack | ||
direction="row" | ||
justifyContent="flex-start" | ||
alignItems="flex-start" | ||
gap={ 2 } | ||
> | ||
<Toggler /> | ||
<div> | ||
<Typography level="title-md"> | ||
Dark Mode | ||
</Typography> | ||
<Typography level="body-md" variant="soft" color="primary"> | ||
{ darkMode.enabled ? 'Enabled' : 'Disabled' } | ||
</Typography> | ||
</div> | ||
</Stack> | ||
); | ||
}; | ||
|
||
export const Toggler = () => { | ||
const { darkMode } = useSettings(); | ||
|
||
return ( | ||
<IconButton | ||
id="boolean-value-toggler" | ||
size="lg" | ||
onClick={ darkMode.toggle } | ||
variant="outlined" | ||
> | ||
{ | ||
darkMode.enabled | ||
? <OnIcon color="primary" /> | ||
: <OffIcon color="neutral" /> | ||
} | ||
</IconButton> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,23 @@ | ||
import React from 'react'; | ||
import { App } from './app'; | ||
import { CssVarsProvider } from '@mui/joy/styles'; | ||
import { createRoot } from 'react-dom/client'; | ||
import { App } from './app'; | ||
import { LayersProvider, SettingsProvider } from '@context'; | ||
import './index.css'; | ||
import '@fontsource/inter'; | ||
import theme from './theme'; | ||
|
||
const container = document.getElementById('root'); | ||
const root = createRoot(container); | ||
|
||
const ProvisionedApp = () => ( | ||
<SettingsProvider> | ||
<LayersProvider> | ||
<App /> | ||
</LayersProvider> | ||
</SettingsProvider> | ||
<CssVarsProvider theme={ theme } defaultMode="system"> | ||
<SettingsProvider> | ||
<LayersProvider> | ||
<App /> | ||
</LayersProvider> | ||
</SettingsProvider> | ||
</CssVarsProvider> | ||
); | ||
|
||
root.render(<ProvisionedApp />); |
Oops, something went wrong.