refactor(notes): use shared types and interfaces in components

This commit is contained in:
devcodetools committed 2026-09-13 16:49:14 +02:00
1 parent 2975b80a94
commit 557e48116a
12 files changed
+16 -57

No files matched your search

+4 -27
View File
@@ -1,33 +1,10 @@
import { useState } from 'react'
import type { Note } from '../types'
import type {
NoteEditorProps,
NoteFormProps,
} from '../interfaces/note-editor'
import DeleteModal from './DeleteModal'
interface EditEditorProps {
mode: 'edit'
note: Note
onUpdate: (id: number, patch: Partial<Pick<Note, 'title' | 'content'>>) => void
onDelete: (id: number) => void
}
interface CreateEditorProps {
mode: 'create'
onCreate: (title: string, content: string) => void
onCancelCreate: () => void
}
type NoteEditorProps = EditEditorProps | CreateEditorProps
interface NoteFormProps {
title: string
content: string
titleMissing: boolean
cancelLabel: string
onTitleChange: (value: string) => void
onContentChange: (value: string) => void
onCancel: () => void
onSubmit: () => void
}
const TITLE_REQUIRED_MESSAGE = 'Le titre est obligatoire.'
function NoteForm({