dify/web/app/components/billing/pricing/plan-switcher/tab.tsx
Stephen Zhou a84c2d36a3
style: format with vp fmt (#38803)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-07-12 15:57:46 +00:00

37 lines
855 B
TypeScript

import { cn } from '@langgenius/dify-ui/cn'
import * as React from 'react'
import { useCallback } from 'react'
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