修改搜索页面选项卡

This commit is contained in:
mtvpls
2025-12-28 09:25:37 +08:00
parent 80842fc3b0
commit d4ae874bc0
2 changed files with 22 additions and 24 deletions

View File

@@ -3,7 +3,7 @@
import React, { useEffect, useRef, useState } from 'react';
interface CapsuleSwitchProps {
options: { label: string; value: string }[];
options: { label: string; value: string; icon?: React.ReactNode }[];
active: string;
onChange: (value: string) => void;
className?: string;
@@ -86,12 +86,13 @@ const CapsuleSwitch: React.FC<CapsuleSwitchProps> = ({
buttonRefs.current[index] = el;
}}
onClick={() => onChange(opt.value)}
className={`relative z-10 w-16 px-3 py-1 text-xs sm:w-20 sm:py-2 sm:text-sm rounded-full font-medium transition-all duration-200 cursor-pointer ${
className={`relative z-10 flex items-center justify-center gap-1.5 px-3 py-1 text-xs sm:px-4 sm:py-2 sm:text-sm rounded-full font-medium transition-all duration-200 cursor-pointer ${
isActive
? 'text-gray-900 dark:text-gray-100'
: 'text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100'
}`}
>
{opt.icon && <span className='inline-flex items-center'>{opt.icon}</span>}
{opt.label}
</button>
);