diff --git a/src/components/tags/TagAutocomplete/index.tsx b/src/components/tags/TagAutocomplete/index.tsx index fc69c6ab..485a6fe1 100644 --- a/src/components/tags/TagAutocomplete/index.tsx +++ b/src/components/tags/TagAutocomplete/index.tsx @@ -109,10 +109,21 @@ const TagAutocompleteUnconnected: FC = ({ {...pop.attributes.popper} >
- + {categories.map((item, i) => ( - + ))} {tags.map((item, i) => ( @@ -121,6 +132,7 @@ const TagAutocompleteUnconnected: FC = ({ title={item} type="tag" key={item} + onSelect={onSelect} /> ))}
diff --git a/src/components/tags/TagAutocompleteRow/index.tsx b/src/components/tags/TagAutocompleteRow/index.tsx index 0340bd3d..27e8b282 100644 --- a/src/components/tags/TagAutocompleteRow/index.tsx +++ b/src/components/tags/TagAutocompleteRow/index.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React, { FC, useCallback } from 'react'; import styles from './styles.module.scss'; import classNames from 'classnames'; import { Icon } from '~/components/input/Icon'; @@ -7,13 +7,21 @@ interface IProps { selected: boolean; title: string; type: string; + onSelect: (val: string) => void; } -const TagAutocompleteRow: FC = ({ selected, type, title }) => ( -
- - {title} -
-); +const TagAutocompleteRow: FC = ({ selected, type, title, onSelect }) => { + const onClick = useCallback(() => onSelect(title), [title, onSelect]); + + return ( +
+ + {title} +
+ ); +}; export { TagAutocompleteRow };