-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change ThemeSwitcher to a Menu Component
- Loading branch information
1 parent
c4d297f
commit 108c5da
Showing
1 changed file
with
18 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,33 @@ | ||
import React from 'react' | ||
import { Select } from '@chakra-ui/react'; | ||
import { Select, Menu, MenuButton, MenuItem, MenuList, Button, Show } from '@chakra-ui/react'; | ||
import { useThemeContext } from 'components/Contexts/ThemeContext/ThemeContext'; | ||
import { ChevronDownIcon, ViewIcon } from '@chakra-ui/icons'; | ||
|
||
export default function () { | ||
|
||
const themeContext = useThemeContext(); | ||
|
||
return ( | ||
<> | ||
<Select variant={'themeSelect'} mt={2} size={{base: 'sm', lg: "md"}} onChange={(event) => themeContext.changeTheme(event.target.selectedOptions[0].value)}> | ||
{/* <Select icon={<MdSave size={24} />} variant={'themeSelect'} mt={2} size={{ base: 'sm', lg: "md" }} onChange={(event) => themeContext.changeTheme(event.target.selectedOptions[0].value)}> | ||
<option selected hidden disabled value="">Theme</option> | ||
<option value='corporate'>Corporate</option> | ||
<option value='fantasy'>👑 Fantasy</option> | ||
</Select> | ||
</Select> */} | ||
<Menu> | ||
<MenuButton mt={2} colorScheme='neutral' variant="solid" as={Button} rightIcon={<ChevronDownIcon />} float={'right'} > | ||
<Show above='md'> | ||
Theme | ||
</Show> | ||
<Show below='md'> | ||
<ViewIcon /> | ||
</Show> | ||
</MenuButton> | ||
<MenuList> | ||
<MenuItem onClick={() => themeContext.changeTheme('corporate')}>Corporate</MenuItem> | ||
<MenuItem onClick={() => themeContext.changeTheme('fantasy')}>👑 Fantasy</MenuItem> | ||
</MenuList> | ||
</Menu> | ||
</> | ||
) | ||
} |