This commit is contained in:
2025-12-01 17:21:38 +08:00
parent 32fee2b8ab
commit fab8c13cb3
7511 changed files with 996300 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
import React, { useCallback } from 'react'
import cn from '@/utils/classnames'
type TabProps<T> = {
Icon: React.ComponentType<{ isActive: boolean }>
value: T
label: string
isActive: boolean
onClick: (value: T) => void
}
const Tab = <T,>({
Icon,
value,
label,
isActive,
onClick,
}: TabProps<T>) => {
const handleClick = useCallback(() => {
onClick(value)
}, [onClick, value])
return (
<div
className='flex cursor-pointer items-center justify-center gap-x-2 px-5 py-3'
onClick={handleClick}
>
<Icon isActive={isActive} />
<span
className={cn(
'system-xl-semibold text-text-secondary',
isActive && 'text-saas-dify-blue-accessible',
)}
>
{label}
</span>
</div>
)
}
export default React.memo(Tab) as typeof Tab