36 lines
822 B
TypeScript
36 lines
822 B
TypeScript
import type { Note, NotePatch } from '../types/note'
|
|
|
|
export type EditorMode = 'create' | 'edit'
|
|
|
|
export interface EditNoteEditorProps {
|
|
mode: 'edit'
|
|
note: Note
|
|
onUpdate: (id: number, patch: NotePatch) => void
|
|
onDelete: (id: number) => void
|
|
}
|
|
|
|
export interface CreateNoteEditorProps {
|
|
mode: 'create'
|
|
onCreate: (title: string, content: string) => void
|
|
onCancelCreate: () => void
|
|
}
|
|
|
|
export type NoteEditorProps = EditNoteEditorProps | CreateNoteEditorProps
|
|
|
|
export interface NoteReadViewProps {
|
|
note: Note
|
|
onEdit: () => void
|
|
onDelete: (id: number) => void
|
|
}
|
|
|
|
export interface NoteFormProps {
|
|
title: string
|
|
content: string
|
|
titleMissing: boolean
|
|
cancelLabel: string
|
|
onTitleChange: (value: string) => void
|
|
onContentChange: (value: string) => void
|
|
onCancel: () => void
|
|
onSubmit: () => void
|
|
}
|