refactor: 重构路由、统一 MorePage 样式并清理冗余
- 新增零依赖路由器 (src/router):路由表 + useSyncExternalStore hook + Link 组件 - 抽出 HomePage,document.title 改由路由表驱动 - MorePage 改用 Tailwind 并复用 Header/Footer,移除 more.css - 清理未使用依赖 (clsx/tailwind-merge/cva/tw-animate-css)、utils.ts、空 icons 目录、未用的 shadcn 主题变量及重复背景图
This commit is contained in:
1 parent
4f687ba457
commit
9ce0c5704a
16 files changed
+230
-402
No files matched your search
@@ -1,20 +1,19 @@
|
||||
import { Link } from "@/router";
|
||||
import type { NavItem } from "@/types";
|
||||
|
||||
interface NavCardProps {
|
||||
item: NavItem;
|
||||
}
|
||||
|
||||
// A clickable navigation card with icon, title, and description
|
||||
// A clickable navigation card with icon, title, and description.
|
||||
// Internal paths ("/...") route client-side; external URLs open in a new tab.
|
||||
export default function NavCard({ item }: NavCardProps) {
|
||||
const { name, desc, path, Icon, color, borderHover } = item;
|
||||
|
||||
return (
|
||||
<a
|
||||
href={path}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={`flex items-center md:flex-col md:text-center gap-5 md:gap-4 p-6 md:py-8 rounded-2xl bg-black/35 backdrop-blur-md border border-white/5 transition-all duration-300 cursor-pointer hover:-translate-y-1 hover:bg-black/45 ${borderHover} group block`}
|
||||
>
|
||||
const className = `flex items-center md:flex-col md:text-center gap-5 md:gap-4 p-6 md:py-8 rounded-2xl bg-black/35 backdrop-blur-md border border-white/5 transition-all duration-300 cursor-pointer hover:-translate-y-1 hover:bg-black/45 ${borderHover} group`;
|
||||
|
||||
const content = (
|
||||
<>
|
||||
<div className="shrink-0 transition-transform duration-300 group-hover:scale-105">
|
||||
<Icon className={color} size={36} />
|
||||
</div>
|
||||
@@ -26,6 +25,20 @@ export default function NavCard({ item }: NavCardProps) {
|
||||
{desc}
|
||||
</span>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
if (path.startsWith("/")) {
|
||||
return (
|
||||
<Link to={path} className={className}>
|
||||
{content}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<a href={path} target="_blank" rel="noopener noreferrer" className={className}>
|
||||
{content}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user