dify/web/app/components/billing/pricing/plan-switcher/plan-range-switcher.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

36 lines
944 B
TypeScript

'use client'
import type { FC } from 'react'
import { Switch } from '@langgenius/dify-ui/switch'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
export enum PlanRange {
monthly = 'monthly',
yearly = 'yearly',
}
type PlanRangeSwitcherProps = {
value: PlanRange
onChange: (value: PlanRange) => void
}
const PlanRangeSwitcher: FC<PlanRangeSwitcherProps> = ({ value, onChange }) => {
const { t } = useTranslation()
return (
<div className="flex items-center justify-end gap-x-3 pr-5">
<Switch
size="lg"
checked={value === PlanRange.yearly}
onCheckedChange={(v) => {
onChange(v ? PlanRange.yearly : PlanRange.monthly)
}}
/>
<span className="system-md-regular text-text-tertiary">
{t(($) => $['plansCommon.annualBilling'], { ns: 'billing', percent: 17 })}
</span>
</div>
)
}
export default React.memo(PlanRangeSwitcher)