import type { MouseEvent } from 'react'; import { CHROME_ICONS } from '../uiAssets'; import { PixelIcon } from './PixelIcon'; type PixelCloseButtonProps = { onClick: () => void; label?: string; placement?: 'absolute' | 'inline'; className?: string; }; /** * RPG 像素风弹窗右上关闭按钮。 * 统一拦截点击冒泡,避免历史手写 overlay / panel 的点击处理影响关闭行为。 */ export function PixelCloseButton({ onClick, label = '关闭面板', placement = 'absolute', className = '', }: PixelCloseButtonProps) { const handleClick = (event: MouseEvent) => { event.preventDefault(); event.stopPropagation(); onClick(); }; const placementClassName = placement === 'absolute' ? 'absolute right-4 top-3 sm:right-5 sm:top-4' : 'relative shrink-0'; return ( ); }