| | |
| | | import { useProviderContext } from '@/context/provider-context' |
| | | |
| | | type Props = { |
| | | onClick?: () => void |
| | | isDisplayOnly?: boolean |
| | | onClick: () => void |
| | | } |
| | | |
| | | const HeaderBillingBtn: FC<Props> = ({ |
| | | onClick, |
| | | isDisplayOnly = false, |
| | | }) => { |
| | | const { plan, enableBilling, isFetchedPlan } = useProviderContext() |
| | | const { |
| | |
| | | })() |
| | | const classNames = (() => { |
| | | if (type === Plan.professional) |
| | | return `border-[#E0F2FE] ${!isDisplayOnly ? 'hover:border-[#B9E6FE]' : ''} bg-[#E0F2FE] text-[#026AA2]` |
| | | return 'border-[#E0F2FE] hover:border-[#B9E6FE] bg-[#E0F2FE] text-[#026AA2]' |
| | | if (type === Plan.team) |
| | | return `border-[#E0EAFF] ${!isDisplayOnly ? 'hover:border-[#C7D7FE]' : ''} bg-[#E0EAFF] text-[#3538CD]` |
| | | return 'border-[#E0EAFF] hover:border-[#C7D7FE] bg-[#E0EAFF] text-[#3538CD]' |
| | | return '' |
| | | })() |
| | | |
| | |
| | | return null |
| | | |
| | | if (type === Plan.sandbox) |
| | | return <UpgradeBtn onClick={isDisplayOnly ? undefined : onClick} isShort /> |
| | | |
| | | const handleClick = () => { |
| | | if (!isDisplayOnly && onClick) |
| | | onClick() |
| | | } |
| | | return <UpgradeBtn onClick={onClick} isShort /> |
| | | |
| | | return ( |
| | | <div |
| | | onClick={handleClick} |
| | | className={cn( |
| | | classNames, |
| | | 'flex h-[22px] items-center rounded-md border px-2 text-xs font-semibold uppercase', |
| | | isDisplayOnly ? 'cursor-default' : 'cursor-pointer', |
| | | )} |
| | | > |
| | | <div onClick={onClick} className={cn(classNames, 'flex items-center h-[22px] px-2 rounded-md border text-xs font-semibold uppercase cursor-pointer')}> |
| | | {name} |
| | | </div> |
| | | ) |