refactor(types): centralize type definitions in shared types file

Move all interface and type definitions to src/types/index.ts to reduce code duplication and improve maintainability. This includes types for components, blog posts, personal info, and localization.
This commit is contained in:
joyzhao
2025-06-19 11:26:47 +08:00
parent acd0fa4bb9
commit 25281f4459
15 changed files with 180 additions and 91 deletions

View File

@@ -3,13 +3,12 @@ import LanguageSwitcher from "./LanguageSwitcher";
import ThemeToggle from "./ui/theme-toggle";
import { useTranslations, getLocalizedPath, type Lang } from "@/i18n/utils";
import { useState, useEffect } from "react";
import { motion, AnimatePresence } from "framer-motion";
import { Menu, X } from "lucide-react";
import { defaultLang } from "@/i18n/ui";
import { type GlassHeaderProps } from "@/types";
// 从window.document.documentElement.lang获取当前语言
interface GlassHeaderProps {
lang?: Lang;
}
export default function GlassHeader({ lang: propLang }: GlassHeaderProps) {
// 优先使用props传入的语言如果没有则尝试从HTML lang属性获取