1- import {
2- Button ,
3- Container ,
4- Drawer ,
5- DrawerBody ,
6- DrawerCloseButton ,
7- DrawerContent ,
8- DrawerHeader ,
9- DrawerOverlay ,
10- VStack ,
11- useColorMode ,
12- useColorModeValue ,
13- useDisclosure ,
14- } from "@chakra-ui/react" ;
15- import React , { useRef } from "react" ;
1+ import { Button , Container , Drawer , VStack } from "@chakra-ui/react" ;
2+ import { ColorModeIcon , OppositeColorModeIcon , useColorMode } from "../utils/color-mode" ;
163import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" ;
174import { Link } from "gatsby" ;
5+ import React from "react" ;
186import { faBars } from "@fortawesome/free-solid-svg-icons/faBars" ;
19- import { faMoon } from "@fortawesome/free-solid-svg-icons/faMoon" ;
20- import { faSun } from "@fortawesome/free-solid-svg-icons/faSun" ;
217
228export interface LinksProps {
239 links : readonly Readonly < {
@@ -40,45 +26,40 @@ const Links = ({ links }: LinksProps): JSX.Element => (
4026
4127const ThemeChangeButton = ( ) : JSX . Element => {
4228 const { toggleColorMode } = useColorMode ( ) ;
43-
44- const currentTheme = < FontAwesomeIcon icon = { useColorModeValue ( faSun , faMoon ) } /> ;
45- const oppositeTheme = < FontAwesomeIcon icon = { useColorModeValue ( faMoon , faSun ) } /> ;
46-
4729 return (
48- < Button leftIcon = { currentTheme } onClick = { toggleColorMode } rightIcon = { oppositeTheme } >
30+ < Button onClick = { toggleColorMode } >
31+ < ColorModeIcon />
4932 →
33+ < OppositeColorModeIcon />
5034 </ Button >
5135 ) ;
5236} ;
5337
5438export const Navigation = ( props : LinksProps ) : JSX . Element => {
55- const { isOpen, onOpen, onClose } = useDisclosure ( ) ;
56- const btnRef = useRef ( null ) ;
57-
5839 return (
59- < >
60- < Button
61- ref = { btnRef }
62- pos = "fixed"
63- zIndex = { 100 }
64- bottom = { 0 }
65- m = { 8 }
66- leftIcon = { < FontAwesomeIcon icon = { faBars } /> }
67- onClick = { onOpen }
68- >
69- メニュー
70- </ Button >
71- < Drawer finalFocusRef = { btnRef } isOpen = { isOpen } onClose = { onClose } placement = "left" >
72- < DrawerOverlay / >
73- < DrawerContent >
74- < DrawerCloseButton />
75- < DrawerHeader borderBottomWidth = "1px" > Approvers</ DrawerHeader >
76- < DrawerBody >
40+ < Drawer . Root placement = "left" >
41+ < Drawer . Backdrop />
42+ < Drawer . Trigger asChild >
43+ < Button
44+ pos = "fixed"
45+ zIndex = { 100 }
46+ bottom = { 0 }
47+ m = { 8 }
48+ leftIcon = { < FontAwesomeIcon icon = { faBars } /> }
49+ >
50+ メニュー
51+ </ Button >
52+ </ Drawer . Trigger >
53+ < Drawer . Positioner >
54+ < Drawer . Content >
55+ < Drawer . CloseTrigger />
56+ < Drawer . Header borderBottomWidth = "1px" > Approvers</ Drawer . Header >
57+ < Drawer . Body >
7758 < Links { ...props } />
78- </ DrawerBody >
59+ </ Drawer . Body >
7960 < ThemeChangeButton />
80- </ DrawerContent >
81- </ Drawer >
82- </ >
61+ </ Drawer . Content >
62+ </ Drawer . Positioner >
63+ </ Drawer . Root >
8364 ) ;
8465} ;
0 commit comments