diff --git a/pages/Dashboard/ToolCard.tsx b/pages/Dashboard/ToolCard.tsx index 6844ad6..e8c37f2 100644 --- a/pages/Dashboard/ToolCard.tsx +++ b/pages/Dashboard/ToolCard.tsx @@ -4,36 +4,29 @@ * 用于在仪表盘中展示各个工具功能的卡片组件,支持图标、标题、描述、 * 快照内容展示,具备悬停动画效果。 */ -import { alpha, Box, Card, CardActionArea, Stack, Typography, useTheme } from '@mui/material'; -import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos'; -import type { SvgIconProps } from '@mui/material/SvgIcon'; +import { ChevronRight } from 'lucide-react'; import type { ComponentType } from 'react'; +import type { SvgIconProps } from '@mui/material/SvgIcon'; import type { PaletteColorKey } from '@/config/features'; -/** - * ToolCard 组件属性接口 - */ +const PALETTE_COLORS: Record = { + primary: '#1976d2', + success: '#2e7d32', + warning: '#e65100', + error: '#c62828', + secondary: '#9c27b0', + info: '#0288d1', +}; + interface ToolCardProps { - /** 工具卡片标题 */ title: string; - /** 工具卡片描述文本(可选) */ description?: string; - /** 快照内容,用于在卡片底部展示额外信息(可选) */ snapshot?: React.ReactNode; - /** 主题色键,映射到 theme.palette[key].main */ colorKey: PaletteColorKey; - /** 图标组件引用 */ icon: ComponentType; - /** 卡片点击事件处理函数 */ onClick: () => void; } -/** - * ToolCard 组件 - * - * @param props - ToolCardProps 属性对象 - * @returns 工具卡片 JSX 元素 - */ export default function ToolCard({ title, description, @@ -42,120 +35,71 @@ export default function ToolCard({ icon: IconComponent, onClick, }: ToolCardProps) { - const theme = useTheme(); - const colorCode = theme.palette[colorKey].main; + const colorCode = PALETTE_COLORS[colorKey]; return ( - { + e.currentTarget.style.borderColor = colorCode; + e.currentTarget.style.boxShadow = `0 12px 24px -10px ${colorCode}33`; + }} + onMouseLeave={(e) => { + e.currentTarget.style.borderColor = ''; + e.currentTarget.style.boxShadow = ''; }} > - - - - +
+
- - - +
+
+ {title} - + {description && ( - + {description} - + )} - - - +
+ { + e.currentTarget.style.color = colorCode; + }} + onMouseLeave={(e) => { + e.currentTarget.style.color = ''; }} /> - +
{snapshot != null && ( - +
{snapshot} - +
)} -
-
+ + ); } diff --git a/pages/Dashboard/index.tsx b/pages/Dashboard/index.tsx index 91b7a85..8a0e3eb 100644 --- a/pages/Dashboard/index.tsx +++ b/pages/Dashboard/index.tsx @@ -1,11 +1,9 @@ -import { Box } from '@mui/material'; import { useRouter } from '@/providers/RouterProvider'; import ToolCard from '@/pages/Dashboard/ToolCard'; import { getFeatureByKey } from '@/config/features'; import type { PageType } from '@/types/storage'; import { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -import { dashboardPageStyles } from '@/config/pageTheme'; export default function DashboardPage() { const { navigateTo, visiblePages, pageOrder } = useRouter(); @@ -14,7 +12,7 @@ export default function DashboardPage() { const visibleSet = useMemo(() => new Set(visiblePages), [visiblePages]); return ( - +
{pageOrder.map((key) => { if (!visibleSet.has(key as PageType)) return null; @@ -32,6 +30,6 @@ export default function DashboardPage() { /> ); })} - +
); }