diff --git a/src/admin/components/Tags/index.tsx b/src/admin/components/Tags/index.tsx index 343ae8d..1b635d4 100644 --- a/src/admin/components/Tags/index.tsx +++ b/src/admin/components/Tags/index.tsx @@ -1,9 +1,8 @@ import React, { FC, useState } from 'react' import { Container } from './style' -import { Tag } from '@strapi/design-system/Tag' -import Cross from '@strapi/icons/Cross' -import { CustomBadge, FormInput, SubTitle, Title } from '../../styles/form' +import { CustomBadge, SubTitle, Title } from '../../styles/form' import { useTheme } from '../../utils/hooks' +import { CreatableCombobox, ComboboxOption } from '@strapi/design-system' interface ITag { tags: string[] @@ -13,54 +12,36 @@ interface ITag { } const Tags: FC = ({ tags, handleSetTag, handleRemoveTag, editable }) => { - const [tag, setTag] = useState('') + const [value, setValue] = useState('') const theme = useTheme() - const handleChange = (e: React.ChangeEvent) => { - setTag(e.target.value) + const onCreateOption = (value: string) => { + handleSetTag(value) + setValue(value) + console.log('CHANGE', value) } - const handleKeyDown = (e: React.KeyboardEvent) => { - const value = tag.trim() - const hasValue = value.length > 0 - if (e.key === 'Enter' || e.key === 'Tab' || e.key === ',') { - e.preventDefault() - if (!hasValue) return - if (tags.some((item) => item === value)) { - return - } - handleSetTag(value) - setTag('') + const onClear = () => { + if (tags.find(tag => tag === value)) { + handleRemoveTag(value) } } + return ( <> - + <Title dark={theme === 'dark'}> Tags <CustomBadge active={tags.length > 0}>{tags.length}</CustomBadge> A list of tags you want to use to describe your video. - {editable && ( - - )} - - {tags.map((item) => { - return ( - handleRemoveTag(item) : undefined} - icon={} - > - {item} - - ) - })} + + {tags.map((tag, i) => ( + + {tag} + + ))} + )