import React, {ChangeEvent} from 'react'; import {faTrash} from '@fortawesome/free-solid-svg-icons'; import {ActChapter} from '@/lib/models/Chapter'; import InputField from '@/components/form/InputField'; import TexteAreaInput from '@/components/form/TexteAreaInput'; import {useTranslations} from 'next-intl'; interface ActChapterItemProps { chapter: ActChapter; onUpdateSummary: (chapterId: string, summary: string) => void; onUnlink: (chapterInfoId: string, chapterId: string) => Promise; } export default function ActChapterItem({chapter, onUpdateSummary, onUnlink}: ActChapterItemProps) { const t = useTranslations('actComponent'); return (
) => onUpdateSummary(chapter.chapterId, e.target.value) } placeholder={t('chapterSummaryPlaceholder')} /> } actionIcon={faTrash} fieldName={chapter.title} action={(): Promise => onUnlink(chapter.chapterInfoId, chapter.chapterId)} actionLabel={t('remove')} />
); }