webapp/src/components/Inbox/Search.tsx

28 lines
667 B
TypeScript
Raw Normal View History

2022-11-10 15:06:02 +00:00
import styles from './Search.module.scss'
import { createSignal } from 'solid-js'
import { Icon } from '../Nav/Icon'
type Props = {
placeholder: string
onChange: (value: () => string) => void
}
const Search = (props: Props) => {
const [value, setValue] = createSignal<string>('')
const search = (event) => {
event.preventDefault()
setValue(event.target.value)
props.onChange(value)
}
return (
<div class={styles.Search}>
<div class={styles.field}>
<input type="text" onInput={search} placeholder={props.placeholder} />
<Icon name="search" class={styles.icon} />
</div>
</div>
)
}
export default Search