import { ChangeEvent } from 'react'; import * as R from 'ramda'; import { Intent, Switch, Tag, Text } from '@blueprintjs/core'; import { Group } from '@/components'; import withSubscriptionPlansActions, { WithSubscriptionPlansActionsProps, } from '@/containers/Subscriptions/withSubscriptionPlansActions'; import { SubscriptionPlansPeriod } from '@/store/plans/plans.reducer'; import styles from './SetupSubscription.module.scss'; interface SubscriptionPlansPeriodsSwitchCombinedProps extends WithSubscriptionPlansActionsProps {} function SubscriptionPlansPeriodSwitcherRoot({ // #withSubscriptionPlansActions changeSubscriptionPlansPeriod, }: SubscriptionPlansPeriodsSwitchCombinedProps) { // Handles the period switch change. const handleSwitchChange = (event: ChangeEvent) => { changeSubscriptionPlansPeriod( event.currentTarget.checked ? SubscriptionPlansPeriod.Annually : SubscriptionPlansPeriod.Monthly, ); }; return ( Pay Monthly Pay Yearly{' '} 25% Off All Year ); } export const SubscriptionPlansPeriodSwitcher = R.compose( withSubscriptionPlansActions, )(SubscriptionPlansPeriodSwitcherRoot);