import {
Box,
Breakpoint,
Button,
Dialog,
DialogActions,
DialogContent,
DialogTitle,
Paper,
PaperProps,
} from "@mui/material"
import Draggable from "react-draggable"
import { useRef, useState } from "react"
import CloseIcon from "@mui/icons-material/Close"
import { limitValue } from "../utils"
import CodeIcon from "@mui/icons-material/Code"
import CompareArrowsIcon from "@mui/icons-material/CompareArrows"
import FullscreenIcon from "@mui/icons-material/Fullscreen"
import { CustomIcon } from "./CustomIcon"
// export function DraggablePaperComponent(props: PaperProps) {
// return (
//
//
//
// )
// }
export function DraggablePaperComponent(props: PaperProps) {
const nodeRef = useRef(null)
return (
)
}
const widthItems = [
["xs", "最小"],
["sm", "较小"],
["md", "中等"],
["lg", "较大"],
["xl", "很大"],
["max", "最大"],
["full", "全屏"],
] as const
function getWidthIndex(w: string) {
const idx = widthItems.findIndex(x => x[0] === w)
return idx === -1 ? 3 : idx
}
type ExtraButtonInfo = {
handler: () => void
title: string
}
export function DraggableDialog({
title,
onCancel,
onOk,
children,
initialWidth,
extraButton,
}: {
title?: string | JSX.Element
onCancel: () => void
onOk?: () => void
children: JSX.Element
initialWidth?: string
extraButton?: ExtraButtonInfo[]
}) {
const [widthIndex, setWidthIndex] = useState(getWidthIndex(initialWidth || ""))
const maxWidth = widthItems[widthIndex][0]
const changeWidth = (n: number) => {
setWidthIndex(old => limitValue(old + n, 0, widthItems.length - 1))
}
// const cName = (props as any).classes.resizable as string;
return (
)
}