@@ -3,13 +3,7 @@ import { addItem } from '../../api/firebase';
33import toast from 'react-hot-toast' ;
44import { Button } from '../ui/button' ;
55import { Input } from '../ui/input' ;
6- import {
7- Select ,
8- SelectTrigger ,
9- SelectContent ,
10- SelectItem ,
11- SelectValue ,
12- } from '../ui/select' ;
6+ import { RadioGroup , RadioGroupItem } from '@/components/ui/radio-group' ;
137
148export default function AddItemForm ( { listPath, data, handleOpenModal } ) {
159 const [ formData , setFormData ] = useState ( {
@@ -62,7 +56,7 @@ export default function AddItemForm({ listPath, data, handleOpenModal }) {
6256 setFormData ( ( prevFormData ) => ( { ...prevFormData , [ name ] : value } ) ) ;
6357 } ;
6458
65- const handleSelectChange = ( value ) => {
59+ const handleRadioChange = ( value ) => {
6660 setFormData ( ( prevFormData ) => ( {
6761 ...prevFormData ,
6862 daysUntilNextPurchase : value ,
@@ -92,16 +86,40 @@ export default function AddItemForm({ listPath, data, handleOpenModal }) {
9286 < label htmlFor = "daysUntilNextPurchase" className = "text-md font-medium" >
9387 How soon would you like to buy this again?
9488 </ label >
95- < Select onValueChange = { handleSelectChange } >
96- < SelectTrigger >
97- < SelectValue placeholder = "Select Time" />
98- </ SelectTrigger >
99- < SelectContent >
100- < SelectItem value = "7" > Soon (7 days)</ SelectItem >
101- < SelectItem value = "14" > Kind of soon (14 days)</ SelectItem >
102- < SelectItem value = "30" > Not soon (30 days)</ SelectItem >
103- </ SelectContent >
104- </ Select >
89+ < RadioGroup
90+ onValueChange = { handleRadioChange }
91+ className = "flex my-2 items-center justify-center gap-4"
92+ id = "daysUntilNextPurchase"
93+ >
94+ < div className = "flex flex-col items-center justify-center rounded-xl border border-light-pink gap-4 w-28 h-28 shadow-bottom-right transition-transform duration-200 ease-in-out transform active:scale-95" >
95+ < RadioGroupItem
96+ value = "7"
97+ id = "soon"
98+ name = "timeFrame"
99+ className = "border border-soon text-soon"
100+ />
101+ < label htmlFor = "soon" className = "font-semibold text-sm" >
102+ Soon
103+ </ label >
104+ </ div >
105+ < div className = "flex flex-col items-center justify-center rounded-xl border border-light-pink gap-4 w-28 h-28 shadow-bottom-right transition-transform duration-200 ease-in-out transform active:scale-95" >
106+ < RadioGroupItem
107+ value = "14"
108+ id = "kind-of-soon"
109+ name = "timeFrame"
110+ className = "border border-kind-of-soon text-kind-of-soon"
111+ />
112+ < label htmlFor = "kind-of-soon" className = "font-semibold text-sm" >
113+ Kind of soon
114+ </ label >
115+ </ div >
116+ < div className = "flex flex-col items-center justify-center rounded-xl border border-light-pink gap-4 w-28 h-28 shadow-bottom-right transition-transform duration-200 ease-in-out transform active:scale-95" >
117+ < RadioGroupItem value = "30" id = "not-of-soon" name = "timeFrame" />
118+ < label htmlFor = "not of soon" className = "font-semibold text-sm" >
119+ Not soon
120+ </ label >
121+ </ div >
122+ </ RadioGroup >
105123 </ div >
106124 < div className = "flex flex-col items-start gap-2 w-full" >
107125 < label htmlFor = "quantity" className = "text-md font-medium" >
@@ -123,7 +141,7 @@ export default function AddItemForm({ listPath, data, handleOpenModal }) {
123141 < div className = "flex w-full" >
124142 < Button
125143 type = "submit"
126- className = "bg-pink text-white rounded-xl w-full hover:bg-pink hover:bg-opacity-75 text-sm"
144+ className = "bg-primary- pink text-white rounded-xl w-full hover:bg-primary -pink hover:bg-opacity-75 text-sm"
127145 >
128146 Add Item
129147 </ Button >
0 commit comments