2025-08-12 21:50:58 +08:00
|
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
|
|
import Link from 'next/link';
|
|
|
|
|
|
|
|
|
|
|
|
import { BackButton } from './BackButton';
|
|
|
|
|
|
import { useSite } from './SiteProvider';
|
|
|
|
|
|
import { ThemeToggle } from './ThemeToggle';
|
2025-12-05 21:12:15 +08:00
|
|
|
|
import { UpdateNotification } from './UpdateNotification';
|
2025-08-12 21:50:58 +08:00
|
|
|
|
import { UserMenu } from './UserMenu';
|
|
|
|
|
|
|
|
|
|
|
|
interface MobileHeaderProps {
|
|
|
|
|
|
showBackButton?: boolean;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const MobileHeader = ({ showBackButton = false }: MobileHeaderProps) => {
|
|
|
|
|
|
const { siteName } = useSite();
|
|
|
|
|
|
return (
|
2025-08-21 21:13:44 +08:00
|
|
|
|
<header className='md:hidden fixed top-0 left-0 right-0 z-[999] w-full bg-white/70 backdrop-blur-xl border-b border-gray-200/50 shadow-sm dark:bg-gray-900/70 dark:border-gray-700/50'>
|
2025-08-12 21:50:58 +08:00
|
|
|
|
<div className='h-12 flex items-center justify-between px-4'>
|
2025-08-21 21:13:44 +08:00
|
|
|
|
{/* 左侧:搜索按钮、返回按钮和设置按钮 */}
|
2025-08-12 21:50:58 +08:00
|
|
|
|
<div className='flex items-center gap-2'>
|
2025-08-21 21:13:44 +08:00
|
|
|
|
<Link
|
|
|
|
|
|
href='/search'
|
2025-11-30 21:33:05 +08:00
|
|
|
|
prefetch={false}
|
2025-08-21 21:13:44 +08:00
|
|
|
|
className='w-10 h-10 p-2 rounded-full flex items-center justify-center text-gray-600 hover:bg-gray-200/50 dark:text-gray-300 dark:hover:bg-gray-700/50 transition-colors'
|
|
|
|
|
|
>
|
|
|
|
|
|
<svg
|
|
|
|
|
|
className='w-full h-full'
|
|
|
|
|
|
fill='none'
|
|
|
|
|
|
stroke='currentColor'
|
|
|
|
|
|
viewBox='0 0 24 24'
|
|
|
|
|
|
xmlns='http://www.w3.org/2000/svg'
|
|
|
|
|
|
>
|
|
|
|
|
|
<path
|
|
|
|
|
|
strokeLinecap='round'
|
|
|
|
|
|
strokeLinejoin='round'
|
|
|
|
|
|
strokeWidth={2}
|
|
|
|
|
|
d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'
|
|
|
|
|
|
/>
|
|
|
|
|
|
</svg>
|
|
|
|
|
|
</Link>
|
2025-08-12 21:50:58 +08:00
|
|
|
|
{showBackButton && <BackButton />}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{/* 右侧按钮 */}
|
|
|
|
|
|
<div className='flex items-center gap-2'>
|
|
|
|
|
|
<ThemeToggle />
|
|
|
|
|
|
<UserMenu />
|
2025-12-05 21:12:15 +08:00
|
|
|
|
<UpdateNotification />
|
2025-08-12 21:50:58 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{/* 中间:Logo(绝对居中) */}
|
|
|
|
|
|
<div className='absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2'>
|
|
|
|
|
|
<Link
|
|
|
|
|
|
href='/'
|
2025-11-30 21:33:05 +08:00
|
|
|
|
prefetch={false}
|
2025-08-12 21:50:58 +08:00
|
|
|
|
className='text-2xl font-bold text-green-600 tracking-tight hover:opacity-80 transition-opacity'
|
|
|
|
|
|
>
|
|
|
|
|
|
{siteName}
|
|
|
|
|
|
</Link>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</header>
|
|
|
|
|
|
);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export default MobileHeader;
|