Download next.js/turbopack/benchmark-apps/mui/components/ModeSwitch.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/turbopack/benchmark-apps/mui/components/ModeSwitch.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/turbopack/benchmark-apps/mui/components/ModeSwitch.tsx
-
curl -L -o ModeSwitch.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/turbopack/benchmark-apps/mui/components/ModeSwitch.tsx
1.09 kB
| 'use client' | |
| import * as React from 'react' | |
| import Box from '@mui/material/Box' | |
| import FormControl from '@mui/material/FormControl' | |
| import InputLabel from '@mui/material/InputLabel' | |
| import MenuItem from '@mui/material/MenuItem' | |
| import Select from '@mui/material/Select' | |
| import { useColorScheme } from '@mui/material/styles' | |
| export default function ModeSwitch() { | |
| const { mode, setMode } = useColorScheme() | |
| if (!mode) { | |
| return null | |
| } | |
| return ( | |
| <Box | |
| sx={{ | |
| display: 'flex', | |
| justifyContent: 'flex-end', | |
| mt: 1, | |
| p: 1, | |
| }} | |
| > | |
| <FormControl> | |
| <InputLabel id="mode-select-label">Theme</InputLabel> | |
| <Select | |
| labelId="mode-select-label" | |
| id="mode-select" | |
| value={mode} | |
| onChange={(event) => setMode(event.target.value as typeof mode)} | |
| label="Theme" | |
| > | |
| <MenuItem value="system">System</MenuItem> | |
| <MenuItem value="light">Light</MenuItem> | |
| <MenuItem value="dark">Dark</MenuItem> | |
| </Select> | |
| </FormControl> | |
| </Box> | |
| ) | |
| } | |