import React from 'react'; import type { PricingPlan } from '../../utils/pricingModel'; interface PlanSliderProps { plans: PricingPlan[]; index: number; onChange: (index: number) => void; } /** Tailwind needs the class spelled out, so the fill spans by lookup. */ const FILL_SPAN = [ 'hidden', 'col-span-1', 'col-span-2', 'col-span-3', 'col-span-4', 'col-span-5', ]; const TRACK_COLS = [ '', 'grid-cols-1', 'grid-cols-2', 'grid-cols-3', 'grid-cols-4', 'grid-cols-5', ]; const STOP_COLS = [ '', 'grid-cols-1', 'grid-cols-2', 'grid-cols-3', 'grid-cols-4', 'grid-cols-5', 'grid-cols-6', ]; /** * How much do you want done: one stop per plan on a slider, the way * recomaze.ai/pricing asks it. The track fills up to the chosen stop; the * stops under it are buttons too. */ export const PlanSlider = ({ plans, index, onChange, }: PlanSliderProps): JSX.Element => { const segments = Math.max(plans.length - 1, 1); return (