From e77b0d79789209714ad5d53eb57efae66cd3603d Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Sun, 26 Oct 2025 20:23:36 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=BB=84=E4=BB=B6):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=BA=BF=E6=80=A7=E8=BF=9B=E5=BA=A6=E6=9D=A1=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=B9=B6=E6=9B=BF=E6=8D=A2=E5=9C=86=E5=BD=A2=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 重构进度指示器,使用新的LinearProgress组件替换原有的CircularProgress 更新文件管理器中的进度指示器引用 修改首页加载动画为线性进度条样式 --- index.html | 55 ++++++++----------- src/component/Common/CircularProgress.tsx | 47 ++++++---------- src/component/Common/LinearProgress.tsx | 30 ++++++++++ .../FileManager/Explorer/Explorer.tsx | 4 +- 4 files changed, 72 insertions(+), 64 deletions(-) create mode 100644 src/component/Common/LinearProgress.tsx diff --git a/index.html b/index.html index 60f7464..f9de47c 100755 --- a/index.html +++ b/index.html @@ -46,43 +46,39 @@ transform: scale(0.8); animation: fadeIn 0.6s ease-out 0.3s forwards; } - #app-loader .spinner { - width: 28px; - height: 28px; - position: relative; + #app-loader .progress-container { + width: 200px; + height: 4px; + background-color: rgba(0, 0, 0, 0.1); + border-radius: 2px; + overflow: hidden; opacity: 0; transform: scale(0.8); animation: fadeIn 0.6s ease-out 0.3s forwards; } - #app-loader .spinner { - display: inline-block; - width: 40px; - height: 40px; - } - #app-loader .spinner svg { - display: block; - } - #app-loader .spinner .stroke { - stroke: var(--defaultThemeColor); - stroke-linecap: round; - animation: spinDash 1.4s ease-in-out infinite; - } - #app-loader .spinner .background { - stroke: rgba(0, 0, 0, 0.1) + #app-loader .progress-bar { + height: 100%; + background-color: var(--defaultThemeColor); + border-radius: 2px; + animation: linearProgress 1.5s infinite ease-in-out; } - @keyframes spinDash { + @keyframes linearProgress { 0% { - stroke-dasharray: 1px, 200px; - stroke-dashoffset: 0; + transform: translateX(-100%); + width: 50%; } 50% { - stroke-dasharray: 100px, 200px; - stroke-dashoffset: -15px; + transform: translateX(100%); + width: 50%; + } + 51% { + transform: translateX(100%); + width: 50%; } 100% { - stroke-dasharray: 1px, 200px; - stroke-dashoffset: -126px; + transform: translateX(-100%); + width: 50%; } } @keyframes fadeIn { @@ -97,11 +93,8 @@
-
- - - - +
+
diff --git a/src/component/Common/CircularProgress.tsx b/src/component/Common/CircularProgress.tsx index 670ad1e..c9bf983 100755 --- a/src/component/Common/CircularProgress.tsx +++ b/src/component/Common/CircularProgress.tsx @@ -1,39 +1,24 @@ -import { Box, CircularProgress, circularProgressClasses, CircularProgressProps } from "@mui/material"; +import { Box } from "@mui/material"; import { forwardRef } from "react"; +import LinearProgressComponent from "./LinearProgress"; -export interface FacebookCircularProgressProps extends CircularProgressProps { +export interface FacebookCircularProgressProps { + sx?: any; + color?: string; + size?: number; + thickness?: number; bgColor?: string; fgColor?: string; } -const FacebookCircularProgress = forwardRef(({ sx, bgColor, fgColor, ...rest }: FacebookCircularProgressProps, ref) => { - return ( - - bgColor ?? theme.palette.grey[theme.palette.mode === "light" ? 200 : 800], - }} - size={40} - thickness={4} - {...rest} - value={100} - /> - fgColor ?? theme.palette.primary.main, - position: "absolute", - left: 0, - [`& .${circularProgressClasses.circle}`]: { - strokeLinecap: "round", - }, - }} - size={40} - thickness={4} - {...rest} - /> - - ); -}); +const FacebookCircularProgress = forwardRef( + ({ sx, color, bgColor, fgColor, ...rest }: FacebookCircularProgressProps, ref) => { + return ( + + + + ); + }, +); export default FacebookCircularProgress; diff --git a/src/component/Common/LinearProgress.tsx b/src/component/Common/LinearProgress.tsx new file mode 100644 index 0000000..8df18e3 --- /dev/null +++ b/src/component/Common/LinearProgress.tsx @@ -0,0 +1,30 @@ +import { Box, LinearProgress, linearProgressClasses } from "@mui/material"; +import { forwardRef } from "react"; + +export interface LinearProgressProps { + color?: string; + height?: number; +} + +const LinearProgressComponent = forwardRef(({ color, height = 8, ...rest }: LinearProgressProps, ref) => { + return ( + + theme.palette.grey[theme.palette.mode === "light" ? 200 : 800], + }, + [`& .${linearProgressClasses.bar}`]: { + borderRadius: height / 2, + backgroundColor: color || ((theme) => theme.palette.primary.main), + }, + }} + /> + + ); +}); + +export default LinearProgressComponent; diff --git a/src/component/FileManager/Explorer/Explorer.tsx b/src/component/FileManager/Explorer/Explorer.tsx index dc11cd3..a9ec86c 100755 --- a/src/component/FileManager/Explorer/Explorer.tsx +++ b/src/component/FileManager/Explorer/Explorer.tsx @@ -6,7 +6,7 @@ import { useAppDispatch, useAppSelector } from "../../../redux/hooks.ts"; import { ConfigLoadState } from "../../../redux/siteConfigSlice.ts"; import { openEmptyContextMenu } from "../../../redux/thunks/filemanager.ts"; import { loadSiteConfig } from "../../../redux/thunks/site.ts"; -import CircularProgress from "../../Common/CircularProgress.tsx"; +import FacebookCircularProgress from "../../Common/CircularProgress.tsx"; import "../../Common/FadeTransition.css"; import { RadiusFrame } from "../../Frame/RadiusFrame.tsx"; import ExplorerError from "./ExplorerError.tsx"; @@ -137,7 +137,7 @@ const Explorer = () => { alignItems: "center", }} > - + )} {index == ExplorerPage.GridView && }