feat: confirm button on post settings modal
This commit is contained in:
parent
a0953be830
commit
bb3336f657
|
|
@ -901,6 +901,9 @@ const useEditorAdvancedModal = ({ isPost }: { isPost: boolean }) => {
|
|||
present({
|
||||
title: t("Advanced Settings"),
|
||||
content: () => <EditorAdvancedModal isPost={isPost} />,
|
||||
modalProps: {
|
||||
withConfirm: true,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useTranslation } from "react-i18next"
|
||||
import { useTranslation } from "~/lib/i18n/client"
|
||||
|
||||
import { Button } from "../ui/Button"
|
||||
import { Modal } from "../ui/Modal"
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@ import React, { Fragment, forwardRef } from "react"
|
|||
|
||||
import { Dialog, Transition } from "@headlessui/react"
|
||||
|
||||
import { useTranslation } from "~/lib/i18n/client"
|
||||
import { cn } from "~/lib/utils"
|
||||
|
||||
import { Button } from "./Button"
|
||||
|
||||
export interface ModalProps {
|
||||
open: boolean
|
||||
setOpen: (open: boolean) => void
|
||||
|
|
@ -17,6 +20,7 @@ export interface ModalProps {
|
|||
panelClassName?: string
|
||||
boxClassName?: string
|
||||
afterLeave?: () => void
|
||||
withConfirm?: boolean
|
||||
}
|
||||
|
||||
export const Modal = forwardRef<HTMLDivElement, ModalProps>(
|
||||
|
|
@ -32,9 +36,12 @@ export const Modal = forwardRef<HTMLDivElement, ModalProps>(
|
|||
panelClassName,
|
||||
boxClassName,
|
||||
afterLeave,
|
||||
withConfirm,
|
||||
},
|
||||
ref,
|
||||
) => {
|
||||
const { t } = useTranslation("common")
|
||||
|
||||
return (
|
||||
<Transition appear show={open} as={Fragment} afterLeave={afterLeave}>
|
||||
<Dialog
|
||||
|
|
@ -102,6 +109,14 @@ export const Modal = forwardRef<HTMLDivElement, ModalProps>(
|
|||
</Dialog.Title>
|
||||
)}
|
||||
{children}
|
||||
{withConfirm && (
|
||||
<Button
|
||||
className="mb-5 mx-auto"
|
||||
onClick={() => setOpen(false)}
|
||||
>
|
||||
{t("Confirm")}
|
||||
</Button>
|
||||
)}
|
||||
</Dialog.Panel>
|
||||
</Transition.Child>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue