mirror of
https://github.com/mosh-hamedani/game-hub.git
synced 2026-05-21 12:14:32 +02:00
Build the color mode switch
This commit is contained in:
parent
7b9df30d05
commit
7d210c5a8f
|
|
@ -13,11 +13,11 @@ function App() {
|
||||||
<NavBar />
|
<NavBar />
|
||||||
</GridItem>
|
</GridItem>
|
||||||
<Show above="lg">
|
<Show above="lg">
|
||||||
<GridItem area="aside" bg="gold">
|
<GridItem area="aside">
|
||||||
Aside
|
Aside
|
||||||
</GridItem>
|
</GridItem>
|
||||||
</Show>
|
</Show>
|
||||||
<GridItem area="main" bg="dodgerblue">
|
<GridItem area="main">
|
||||||
Main
|
Main
|
||||||
</GridItem>
|
</GridItem>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
|
||||||
14
src/components/ColorModeSwitch.tsx
Normal file
14
src/components/ColorModeSwitch.tsx
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { HStack, Switch, Text, useColorMode } from '@chakra-ui/react'
|
||||||
|
|
||||||
|
const ColorModeSwitch = () => {
|
||||||
|
const {toggleColorMode, colorMode} = useColorMode();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<HStack>
|
||||||
|
<Switch colorScheme='green' isChecked={colorMode === 'dark'} onChange={toggleColorMode} />
|
||||||
|
<Text>Dark Mode</Text>
|
||||||
|
</HStack>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ColorModeSwitch
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
import { HStack, Image, Text } from '@chakra-ui/react'
|
import { HStack, Image } from '@chakra-ui/react'
|
||||||
import logo from '../assets/logo.webp';
|
import logo from '../assets/logo.webp';
|
||||||
|
import ColorModeSwitch from './ColorModeSwitch';
|
||||||
|
|
||||||
const NavBar = () => {
|
const NavBar = () => {
|
||||||
return (
|
return (
|
||||||
<HStack>
|
<HStack justifyContent='space-between' padding='10px'>
|
||||||
<Image src={logo} boxSize='60px' />
|
<Image src={logo} boxSize='60px' />
|
||||||
<Text>NavBar</Text>
|
<ColorModeSwitch />
|
||||||
</HStack>
|
</HStack>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue