File tree Expand file tree Collapse file tree 1 file changed +22
-21
lines changed
src/components/LanguagePicker Expand file tree Collapse file tree 1 file changed +22
-21
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ import {
19
19
import { Button } from "@/components/Buttons"
20
20
import { BaseLink } from "@/components/Link"
21
21
22
+ import { isMobile } from "@/lib/utils/isMobile"
23
+
22
24
import MenuItem from "./MenuItem"
23
25
import NoResultsCallout from "./NoResultsCallout"
24
26
import { useLanguagePicker } from "./useLanguagePicker"
@@ -59,6 +61,23 @@ const LanguagePicker = ({
59
61
inputRef . current ?. focus ( )
60
62
} )
61
63
64
+ const MobileCloseBar = ( ) => {
65
+ return (
66
+ < Flex
67
+ justifyContent = "end"
68
+ hideFrom = "md"
69
+ position = "sticky"
70
+ zIndex = "sticky"
71
+ top = "0"
72
+ bg = "background.base"
73
+ >
74
+ < Button p = "4" variant = "ghost" alignSelf = "end" onClick = { ( ) => onClose ( ) } >
75
+ { t ( "common:close" ) }
76
+ </ Button >
77
+ </ Flex >
78
+ )
79
+ }
80
+
62
81
return (
63
82
< Menu isLazy placement = { placement } autoSelect = { false } { ...disclosure } >
64
83
{ children }
@@ -76,23 +95,8 @@ const LanguagePicker = ({
76
95
{ ...props }
77
96
>
78
97
{ /* Mobile Close bar */ }
79
- < Flex
80
- justifyContent = "end"
81
- hideFrom = "md"
82
- position = "sticky"
83
- zIndex = "sticky"
84
- top = "0"
85
- bg = "background.base"
86
- >
87
- < Button
88
- p = "4"
89
- variant = "ghost"
90
- alignSelf = "end"
91
- onClick = { ( ) => onClose ( ) }
92
- >
93
- { t ( "common:close" ) }
94
- </ Button >
95
- </ Flex >
98
+ { /* avoid rendering mobile only feature on desktop */ }
99
+ { isMobile ( ) && < MobileCloseBar /> }
96
100
97
101
{ /* Main Language selection menu */ }
98
102
< Box
@@ -146,10 +150,7 @@ const LanguagePicker = ({
146
150
} }
147
151
onFocus = { handleInputFocus }
148
152
/>
149
- < InputRightElement
150
- hideBelow = "md"
151
- cursor = "text"
152
- >
153
+ < InputRightElement hideBelow = "md" cursor = "text" >
153
154
< Kbd
154
155
fontSize = "sm"
155
156
lineHeight = "none"
You can’t perform that action at this time.
0 commit comments