Skip to content

Commit

Permalink
fix(pages/languages): persist render of close button for input
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerAPfledderer committed Aug 30, 2023
1 parent 2f033ed commit e2456e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/components/Input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type WithIconProps = CommonProps & {
/**
* The Icon used to render `InputRightElement` on the right side of the input
*/
rightIcon?: JSX.Element
rightIcon: JSX.Element
/**
* Primarily for style props to be applied to the wrapper
*/
Expand Down
20 changes: 9 additions & 11 deletions src/pages/languages.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
Box,
CloseButton,
Flex,
Heading,
IconButton,
Expand Down Expand Up @@ -98,17 +99,14 @@ const LanguagesPage = ({ location }: PageProps<Queries.LanguagesPageQuery>) => {
placeholder={searchString}
onChange={(e) => setKeyword(e.target.value)}
rightIcon={
keyword !== "" ? (
<IconButton
icon={<MdClose />}
onClick={resetKeyword}
position="absolute"
insetInlineEnd={1}
aria-label={t("clear")}
variant="ghost"
_hover={{ svg: { fill: "primary" } }}
/>
) : undefined
<IconButton
icon={<MdClose />}
onClick={resetKeyword}
display={keyword === "" ? "none" : undefined}
aria-label={t("clear")}
variant="ghost"
_hover={{ svg: { fill: "primary" } }}
/>
}
/>
</Box>
Expand Down

0 comments on commit e2456e1

Please sign in to comment.