File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed
src/components/Nav/Mobile Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { useTranslation } from "next-i18next"
2
2
import { BsTranslate } from "react-icons/bs"
3
3
import { MdBrightness2 , MdSearch , MdWbSunny } from "react-icons/md"
4
+ import { Button , ButtonProps , Icon , MenuButton } from "@chakra-ui/react"
4
5
5
6
import LanguagePicker from "@/components/LanguagePicker"
6
7
@@ -11,6 +12,17 @@ import FooterItemText from "./FooterItemText"
11
12
12
13
import useColorModeValue from "@/hooks/useColorModeValue"
13
14
15
+ /**
16
+ * This is necessary to be backwards compatible with the old FooterButton
17
+ * component where the ref was NOT passed to the Button component in order to
18
+ * render the MenuList with an undefined position (not relative to the button).
19
+ *
20
+ * TODO: remove this component once the LanguagePicker component is migrated
21
+ */
22
+ function ButtonWORef ( props : ButtonProps ) {
23
+ return < Button { ...props } />
24
+ }
25
+
14
26
type MenuFooterProps = {
15
27
onToggle : ( ) => void
16
28
toggleColorMode : ( ) => void
@@ -57,9 +69,19 @@ const MenuFooter = ({
57
69
opacity : 0.4 ,
58
70
} } // TODO: Replace with overlay component
59
71
>
60
- < FooterButton icon = { BsTranslate } name = { MOBILE_LANGUAGE_BUTTON_NAME } >
72
+ < MenuButton
73
+ as = { ButtonWORef }
74
+ name = { MOBILE_LANGUAGE_BUTTON_NAME }
75
+ leftIcon = { < Icon as = { BsTranslate } /> }
76
+ sx = { { span : { m : 0 } } }
77
+ variant = "ghost"
78
+ flexDir = "column"
79
+ alignItems = "center"
80
+ color = "body.base"
81
+ px = "1"
82
+ >
61
83
< FooterItemText > { t ( "languages" ) } </ FooterItemText >
62
- </ FooterButton >
84
+ </ MenuButton >
63
85
</ LanguagePicker >
64
86
</ div >
65
87
)
You can’t perform that action at this time.
0 commit comments