Notes Modal Component (notes-modal.tsx)

This file defines a React modal component for editing and saving additional notes related to a case or image.

Types

NotesModalProps

Props for the NotesModal component:

  • isOpen: boolean – Whether the modal is open.

  • onClose: () => void – Callback to close the modal.

  • notes: string – The current notes content.

  • onSave: (notes: string) => void – Callback to save the notes.


Component

NotesModal(props: NotesModalProps)

A modal dialog for editing additional notes.

State:

  • tempNotes: Local state for the notes being edited.

Effects:

  • Adds an event listener to close the modal on Escape key press when open.

Features:

  • Text Area:

    • Allows the user to edit the notes content.
  • Save Button:

    • Saves the edited notes and closes the modal.
  • Cancel Button:

    • Closes the modal without saving changes.
  • Accessibility:

    • Modal can be closed with the Escape key or the cancel button.

Rendering:

  • Returns null if the modal is not open.

  • Otherwise, displays the modal overlay and content.

Updated on