import PostFormTagsArea from '@/components/PostFormTagsArea'
import FieldWarning from '@/components/common/FieldWarning'

import type { ComponentPropsWithoutRef, FC } from 'react'

type Props = Omit<ComponentPropsWithoutRef<'textarea'>, 'value' | 'onChange'> & {
  tags:      string
  setTags:   (tags: string) => void
  warnings?: string[]
  errors?:   string[] }


const PostTagsField: FC<Props> = (
    { tags,
      setTags,
      warnings,
      errors,
      ...rest },
) => (
    <div className="space-y-2">
      <PostFormTagsArea
          {...rest}
          tags={tags}
          setTags={setTags}
          errors={errors}/>
      <FieldWarning messages={warnings}/>
    </div>)

export default PostTagsField
