Skip to content

Commit

Permalink
Change ThemeSwitcher to a Menu Component
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-desmond committed Feb 14, 2024
1 parent c4d297f commit 108c5da
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/components/ui/ThemeSwitcher/ThemeSwitcher.tsx
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>
</>
)
}

0 comments on commit 108c5da

Please sign in to comment.