Skip to content

Commit 4e388a3

Browse files
authored
feat(pricing-plan) - fix bug related to the radio card input (#722)
1 parent 5443b72 commit 4e388a3

2 files changed

Lines changed: 40 additions & 19 deletions

File tree

example/src/ContractorOnboarding.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ const PricingPlanCards = ({
4343
title={option.label}
4444
description={option.description}
4545
features={option.meta?.features as string[]}
46-
value={field.value}
47-
onSelect={() => field.onChange(option.value)}
46+
value={option.value}
47+
onSelect={(value: string) => {
48+
field.onChange(value);
49+
}}
4850
selected={field.value === option.value}
4951
/>
5052
))}

example/src/components/PricingPlanCard.tsx

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,15 @@ import {
66
CardContent,
77
CardFooter,
88
} from '@remoteoss/remote-flows/internals';
9-
import {
10-
RadioGroup,
11-
RadioGroupItem,
12-
cn,
13-
} from '@remoteoss/remote-flows/internals';
9+
import { cn } from '@remoteoss/remote-flows/internals';
1410
import { Check } from 'lucide-react';
1511

1612
interface PricingPlanCardProps {
1713
title: React.ReactNode;
1814
description: React.ReactNode;
1915
features: string[];
2016
selected?: boolean;
21-
onSelect?: () => void;
17+
onSelect?: (value: string) => void;
2218
value: string;
2319
}
2420

@@ -36,7 +32,9 @@ export function PricingPlanCard({
3632
'px-4 py-4 border-dashed border-[#9AA6B2] cursor-pointer transition-all',
3733
selected && 'border-solid border-[#9AA6B2] ring-2 ring-[#9AA6B2]',
3834
)}
39-
onClick={onSelect}
35+
onClick={() => {
36+
onSelect?.(value);
37+
}}
4038
>
4139
<CardHeader className='pb-4'>
4240
<CardTitle className='text-xl font-bold'>{title}</CardTitle>
@@ -56,17 +54,38 @@ export function PricingPlanCard({
5654
</CardContent>
5755

5856
<CardFooter className='pt-4'>
59-
<RadioGroup value={selected ? value : undefined} className='w-full'>
60-
<div className='flex items-center gap-2'>
61-
<RadioGroupItem value={value} id={value} />
62-
<label
63-
htmlFor={value}
64-
className='cursor-pointer text-sm font-medium'
65-
>
66-
Select plan
67-
</label>
57+
<div className='flex items-center gap-3 w-full'>
58+
<div
59+
style={{
60+
width: '20px',
61+
height: '20px',
62+
borderRadius: '50%',
63+
border: `2px solid ${selected ? '#9AA6B2' : '#D1D5DB'}`,
64+
backgroundColor: selected ? '#9AA6B2' : '#FFFFFF',
65+
display: 'flex',
66+
alignItems: 'center',
67+
justifyContent: 'center',
68+
flexShrink: 0,
69+
transition: 'all 0.2s',
70+
}}
71+
>
72+
{selected && (
73+
<Check
74+
className='text-white'
75+
style={{ width: '12px', height: '12px' }}
76+
/>
77+
)}
6878
</div>
69-
</RadioGroup>
79+
<span
80+
style={{
81+
fontSize: '14px',
82+
fontWeight: 500,
83+
color: selected ? '#364452' : '#6B7280',
84+
}}
85+
>
86+
Select plan
87+
</span>
88+
</div>
7089
</CardFooter>
7190
</Card>
7291
);

0 commit comments

Comments
 (0)