1
0
mirror of https://github.com/kremalicious/blog.git synced 2025-02-14 21:10:25 +01:00
blog/src/components/molecules/Search/SearchInput.tsx
2019-11-16 14:06:03 +01:00

35 lines
700 B
TypeScript

import React from 'react'
import Input from '../../atoms/Input'
import Icon from '../../atoms/Icon'
import styles from './SearchInput.module.scss'
export default function SearchInput({
value,
onToggle,
onChange
}: {
value: string
onToggle(): void
onChange(e: Event): void
}) {
return (
<>
<Input
className={styles.searchInput}
type="search"
placeholder="Search everything"
autoFocus // eslint-disable-line
value={value}
onChange={onChange}
/>
<button
className={styles.searchInputClose}
onClick={onToggle}
title="Close search"
>
<Icon name="X" />
</button>
</>
)
}