From 4eb0c25682a225f1333229177f9ca972e3624aea Mon Sep 17 00:00:00 2001 From: yangtb2024 <164613316+yangtb2024@users.noreply.github.com> Date: Sat, 15 Feb 2025 15:27:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=AA=97=E5=8F=A3=E8=BE=83=E5=B0=8F?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=B7=A5=E5=85=B7=E6=98=BE=E7=A4=BA=E9=80=82?= =?UTF-8?q?=E9=85=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/Popups/MinAppsPopover.tsx | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/renderer/src/components/Popups/MinAppsPopover.tsx b/src/renderer/src/components/Popups/MinAppsPopover.tsx index a52d8d6e..9a3c7da3 100644 --- a/src/renderer/src/components/Popups/MinAppsPopover.tsx +++ b/src/renderer/src/components/Popups/MinAppsPopover.tsx @@ -4,7 +4,7 @@ import App from '@renderer/pages/apps/App' import { Popover } from 'antd' import { Empty } from 'antd' import { isEmpty } from 'lodash' -import { FC, useState } from 'react' +import { FC, useState, useEffect } from 'react' import { useHotkeys } from 'react-hotkeys-hook' import styled from 'styled-components' @@ -26,8 +26,22 @@ const MinAppsPopover: FC = ({ children }) => { setOpen(false) } + const [maxHeight, setMaxHeight] = useState(window.innerHeight - 100); + + useEffect(() => { + const handleResize = () => { + setMaxHeight(window.innerHeight - 100); + }; + + window.addEventListener('resize', handleResize); + + return () => { + window.removeEventListener('resize', handleResize); + }; + }, []); + const content = ( - + {minapps.map((app) => ( @@ -54,12 +68,15 @@ const MinAppsPopover: FC = ({ children }) => { ) } -const PopoverContent = styled(Scrollbar)`` - -const AppsContainer = styled.div` - display: grid; - grid-template-columns: repeat(6, minmax(90px, 1fr)); - gap: 18px; +const PopoverContent = styled(Scrollbar)<{ maxHeight: number }>` + max-height: ${(props) => props.maxHeight}px; + overflow-y: auto; ` +const AppsContainer = styled.div` +display: grid; + grid-template-columns: repeat(6, minmax(90px, 1fr)); + gap: 18px; +`; + export default MinAppsPopover