diff --git a/apps/readest-app/src/components/WindowButtons.tsx b/apps/readest-app/src/components/WindowButtons.tsx index 644f982b..e8da0093 100644 --- a/apps/readest-app/src/components/WindowButtons.tsx +++ b/apps/readest-app/src/components/WindowButtons.tsx @@ -12,6 +12,24 @@ interface WindowButtonsProps { onClose?: () => void; } +interface WindowButtonProps { + id: string; + onClick: () => void; + ariaLabel: string; + children: React.ReactNode; +} + +const WindowButton: React.FC = ({ onClick, ariaLabel, id, children }) => ( + +); + const WindowButtons: React.FC = ({ className, headerRef, @@ -27,11 +45,7 @@ const WindowButtons: React.FC = ({ const handleMouseDown = async (e: MouseEvent) => { const target = e.target as HTMLElement; - if (target !== e.currentTarget) { - return; - } - - if (target.closest('#exclude-title-bar-mousedown')) { + if (target.closest('.window-button') || target.closest('#exclude-title-bar-mousedown')) { return; } @@ -83,45 +97,30 @@ const WindowButtons: React.FC = ({ )} > {showMinimize && ( - + )} {showMaximize && ( - + )} {showClose && ( - + )} );