19 lines
520 B
TypeScript
19 lines
520 B
TypeScript
import type { Note } from '@/entities/note'
|
|
import { updateNote } from '@/features/edit-note/api/actions'
|
|
|
|
export function EditNoteForm({ note }: { note: Note }) {
|
|
return (
|
|
<form action={updateNote.bind(null, note.id)}>
|
|
<label>
|
|
Title
|
|
<input name="title" defaultValue={note.title} required maxLength={200} />
|
|
</label>
|
|
<label>
|
|
Body
|
|
<textarea name="body" rows={3} defaultValue={note.body} />
|
|
</label>
|
|
<button type="submit">Save</button>
|
|
</form>
|
|
)
|
|
}
|