webapp/src/components/_shared/SearchField.tsx
Tony 0b70289195
Prepare inbox (#65)
Chat client - MVP
2022-12-17 06:27:00 +03:00

30 lines
766 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import styles from './SearchField.module.scss'
import { Icon } from './Icon'
import { t } from '../../utils/intl'
import { clsx } from 'clsx'
type SearchFieldProps = {
onChange: (value: string) => void
class?: string
}
export const SearchField = (props: SearchFieldProps) => {
const handleInputChange = (event) => props.onChange(event.target.value.trim())
return (
<div class={clsx(styles.searchField, props.class)}>
<label for="search-field">
<Icon name="search" class={styles.icon} />
</label>
<input
id="search-field"
type="text"
class="search-input"
onInput={handleInputChange}
placeholder={t('Search')}
/>
<label for="search-field">Поиск</label>
</div>
)
}