import { PlayCircleOutlined, CloseOutlined } from '@ant-design/icons'; import React, { useRef } from 'react'; import Draggable from 'react-draggable'; import clsx from 'clsx'; interface Props { children: React.ReactNode; defaultPosition?: { x: number; y: number }; // 新增 title: string; onClose: () => void; } const DraggableBox: React.FC = ({ children, defaultPosition = { x: 0, y: 0 }, title, onClose, }) => { const nodeRef = useRef(null); return (
{/* 拖拽标题栏 + 关闭按钮 */}
{title}
{/* 关闭按钮,阻止拖拽冒泡 */}
{ e.stopPropagation(); onClose(); }} className="w-6 h-6 flex items-center justify-center rounded hover:bg-red-100 cursor-pointer transition-colors" >
{/* 传入的视频内容 */}
{children}
); }; export default DraggableBox;