Skip to content

Commit

Permalink
refs #1529 Clear search results when clear button is clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
h3poteto committed Jul 27, 2024
1 parent bb45a9c commit a4aa8d1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/search/Results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,20 @@ export default function Results(props: Props) {
setStatuses(renew)
}

const clear = () => {
setWord('')
setAccounts([])
setHashtags([])
setStatuses([])
}

return (
<>
<div style={{ margin: '12px 0' }}>
<Form onCheck={() => search(word)}>
<InputGroup inside>
<Input placeholder={formatMessage({ id: 'search.placeholder' })} value={word} onChange={value => setWord(value)} />
<InputGroup.Button onClick={() => setWord('')}>
<InputGroup.Button onClick={() => clear()}>
{word.length === 0 ? (
<Icon as={BsSearch} title={formatMessage({ id: 'search.search' })} />
) : (
Expand Down

0 comments on commit a4aa8d1

Please sign in to comment.