clouddisk-project/frontend/src/renderer/components/RightClickMenu.jsx

36 lines
860 B
JavaScript

import React from 'react';
import { Menu, Modal } from 'antd';
function RightClickMenu({ visible, position, onClose, onAction }) {
const menuItems = [
{ key: 'open', label: '打开' },
{ key: 'download', label: '下载' },
{ key: 'share', label: '分享' },
{ key: 'rename', label: '重命名' },
{ key: 'copy', label: '复制' },
{ key: 'move', label: '移动' },
{ type: 'divider' },
{ key: 'delete', label: '删除', danger: true },
];
return (
<Menu
style={{
display: visible ? 'block' : 'none',
position: 'fixed',
left: position?.x || 0,
top: position?.y || 0,
zIndex: 1000,
boxShadow: '0 2px 8px rgba(0,0,0,0.15)',
}}
items={menuItems}
onClick={({ key }) => {
onAction?.(key);
onClose?.();
}}
/>
);
}
export;