refactor: update DialogDelete component to use selectedId and close callback

This commit is contained in:
Ardeman
2025-03-13 09:36:40 +08:00
parent b00adf89ec
commit 798896e4ee
5 changed files with 18 additions and 36 deletions
+5 -13
View File
@@ -8,22 +8,16 @@ import TextStyle from '@tiptap/extension-text-style'
import { EditorContent, useEditor } from '@tiptap/react'
import StarterKit from '@tiptap/starter-kit'
import { useEffect, useId, useState } from 'react'
import {
get,
type FieldError,
type FieldValues,
type Path,
type RegisterOptions,
} from 'react-hook-form'
import { get, type FieldError, type RegisterOptions } from 'react-hook-form'
import { useRemixFormContext } from 'remix-hook-form'
import { twMerge } from 'tailwind-merge'
import { EditorMenuBar } from './editor-menubar'
import { EditorTextArea } from './editor-textarea'
type TProperties<TFormValues extends FieldValues> = {
type TProperties = {
id?: string
name: Path<TFormValues>
name: string
label?: string
placeholder?: string
labelClassName?: string
@@ -36,9 +30,7 @@ type TProperties<TFormValues extends FieldValues> = {
category: string
}
export const TextEditor = <TFormValues extends Record<string, unknown>>(
properties: TProperties<TFormValues>,
) => {
export const TextEditor = (properties: TProperties) => {
const {
id,
label,
@@ -92,7 +84,7 @@ export const TextEditor = <TFormValues extends Record<string, unknown>>(
immediatelyRender: false,
content: watchContent,
onUpdate: ({ editor }) => {
setValue(name, editor.getHTML() as any) // eslint-disable-line @typescript-eslint/no-explicit-any
setValue(name, editor.getHTML() as string)
},
})
useEffect(() => {