summaryrefslogtreecommitdiff
path: root/src/components/shared/TextFilter.tsx
blob: 79c2cfb3c0c28bda33be2b12cbc5a8421edc3347 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import type { PrimitiveAtom } from 'jotai';
import * as React from 'react';

import { useTextInput } from '~/hooks/useTextInput';

import s from './TextFilter.module.scss';

export function TextFilter(props: { textAtom: PrimitiveAtom<string>; placeholder?: string }) {
  const [onChange, text] = useTextInput(props.textAtom);
  return (
    <input
      className={s.input}
      type="text"
      value={text}
      onChange={onChange}
      placeholder={props.placeholder}
    />
  );
}