chore(cleanup): 清理废弃组件与旧版本归档

- 删除 detail-v2 旧版叙事组件
- 删除 narrative 旧版区块组件
- 删除 theme-toggle 主题切换与 theme-context 上下文
- 删除 detail-data-proof/service-value/solution-value 旧版组件
- 删除 home-content-v2/v3 旧版首页
- 归档旧版营销页面内容至 _archive 目录
This commit is contained in:
张翔
2026-07-07 06:54:10 +08:00
parent b5245f9aa2
commit 8def296301
33 changed files with 6200 additions and 3645 deletions
-73
View File
@@ -1,73 +0,0 @@
'use client';
import { useTheme } from '@/contexts/theme-context';
import { Sun, Moon, Monitor } from 'lucide-react';
import { useCallback, useState, useRef, useEffect } from 'react';
const THEME_OPTIONS = [
{ value: 'light' as const, label: '浅色', icon: Sun },
{ value: 'dark' as const, label: '深色', icon: Moon },
{ value: 'system' as const, label: '跟随系统', icon: Monitor },
];
export function ThemeToggle() {
const { theme, setTheme } = useTheme();
const [open, setOpen] = useState(false);
const ref = useRef<HTMLDivElement>(null);
useEffect(() => {
function handleClick(e: MouseEvent) {
if (ref.current && !ref.current.contains(e.target as Node)) {
setOpen(false);
}
}
document.addEventListener('mousedown', handleClick);
return () => document.removeEventListener('mousedown', handleClick);
}, []);
const handleSelect = useCallback(
(value: 'light' | 'dark' | 'system') => {
setTheme(value);
setOpen(false);
},
[setTheme],
);
const CurrentIcon =
THEME_OPTIONS.find((o) => o.value === theme)?.icon ?? Monitor;
return (
<div ref={ref} className="relative">
<button
onClick={() => setOpen(!open)}
className="flex items-center justify-center w-9 h-9 rounded-lg text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] hover:bg-[var(--color-bg-hover)] transition-colors"
aria-label="切换主题"
aria-expanded={open}
>
<CurrentIcon className="w-[18px] h-[18px]" strokeWidth={1.8} />
</button>
{open && (
<div className="absolute right-0 top-full mt-2 w-36 rounded-lg border border-[var(--color-border-primary)] bg-[var(--color-bg-primary)] shadow-lg py-1 z-50">
{THEME_OPTIONS.map((opt) => {
const Icon = opt.icon;
const isActive = theme === opt.value;
return (
<button
key={opt.value}
onClick={() => handleSelect(opt.value)}
className={`flex items-center gap-2.5 w-full px-3 py-2 text-sm transition-colors ${isActive
? 'text-[var(--color-brand-primary)] bg-[var(--color-brand-primary-bg)]'
: 'text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)] hover:bg-[var(--color-bg-hover)]'
}`}
>
<Icon className="w-4 h-4" strokeWidth={1.8} />
<span>{opt.label}</span>
</button>
);
})}
</div>
)}
</div>
);
}