Skip to content

Commit e2456e1

Browse files
fix(pages/languages): persist render of close button for input
1 parent 2f033ed commit e2456e1

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/components/Input/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type WithIconProps = CommonProps & {
1515
/**
1616
* The Icon used to render `InputRightElement` on the right side of the input
1717
*/
18-
rightIcon?: JSX.Element
18+
rightIcon: JSX.Element
1919
/**
2020
* Primarily for style props to be applied to the wrapper
2121
*/

src/pages/languages.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
Box,
3+
CloseButton,
34
Flex,
45
Heading,
56
IconButton,
@@ -98,17 +99,14 @@ const LanguagesPage = ({ location }: PageProps<Queries.LanguagesPageQuery>) => {
9899
placeholder={searchString}
99100
onChange={(e) => setKeyword(e.target.value)}
100101
rightIcon={
101-
keyword !== "" ? (
102-
<IconButton
103-
icon={<MdClose />}
104-
onClick={resetKeyword}
105-
position="absolute"
106-
insetInlineEnd={1}
107-
aria-label={t("clear")}
108-
variant="ghost"
109-
_hover={{ svg: { fill: "primary" } }}
110-
/>
111-
) : undefined
102+
<IconButton
103+
icon={<MdClose />}
104+
onClick={resetKeyword}
105+
display={keyword === "" ? "none" : undefined}
106+
aria-label={t("clear")}
107+
variant="ghost"
108+
_hover={{ svg: { fill: "primary" } }}
109+
/>
112110
}
113111
/>
114112
</Box>

0 commit comments

Comments
 (0)