@@ -6,6 +6,7 @@ import { moreThan24HoursPassed, getDaysBetweenDates } from "../utils";
66import { ItemQuantityForm } from "./forms/ItemQuantityForm" ;
77import Button from "react-bootstrap/Button" ;
88import Form from "react-bootstrap/Form" ;
9+ import { MdOutlineDeleteForever } from "react-icons/md" ;
910
1011interface Props {
1112 item : ListItem ;
@@ -63,6 +64,8 @@ export function ListItemCheckBox({ item, listPath }: Props) {
6364 return "kind of soon" ;
6465 } ;
6566
67+ const urgencyStatus = getUrgencyStatus ( item ) ;
68+
6669 const handleCheckChange = async ( e : React . ChangeEvent < HTMLInputElement > ) => {
6770 const newCheckedState = e . target . checked ;
6871
@@ -119,25 +122,41 @@ export function ListItemCheckBox({ item, listPath }: Props) {
119122 } ;
120123
121124 return (
122- < div className = "ListItem" >
123- < Form . Check
124- type = "checkbox"
125- id = { `checkbox-${ item . id } ` }
126- aria-label = { `Mark ${ item . name } as purchased.` }
127- value = { item . id }
128- checked = { isChecked }
129- onChange = { handleCheckChange }
130- aria-checked = { isChecked }
131- disabled = { isChecked }
132- />
133- < ItemQuantityForm saveItemQuantity = { editItemQuantity } item = { item } /> x{ " " }
134- { item . name } { " " }
135- < span >
136- { getUrgencyStatus ( item ) }
137- < Button className = "custom-button" onClick = { ( ) => deleteItemHandler ( ) } >
138- Delete Item
139- </ Button >
125+ < div className = "d-flex flex-column justify-content-center mt-5" >
126+ < span
127+ className = { `UrgencyStatus text-center text-nowrap ms-5 w-auto p-1 ${ urgencyStatus . replace ( / \s / g, "-" ) } ` }
128+ >
129+ { urgencyStatus }
140130 </ span >
131+ < section className = "ListItemBox custom-borders d-flex p-2 m-1 align-items-center" >
132+ < section className = "PurchaseItem d-flex flex-grow-1" >
133+ < Form . Check
134+ className = "me-3"
135+ type = "checkbox"
136+ id = { `checkbox-${ item . id } ` }
137+ aria-label = { `Mark ${ item . name } as purchased.` }
138+ value = { item . id }
139+ checked = { isChecked }
140+ onChange = { handleCheckChange }
141+ aria-checked = { isChecked }
142+ disabled = { isChecked }
143+ />
144+ < Form . Label > { item . name } </ Form . Label >
145+ </ section >
146+
147+ < section className = "EditItem d-flex gap-2 align-items-end" >
148+ < ItemQuantityForm saveItemQuantity = { editItemQuantity } item = { item } />
149+
150+ < Button
151+ className = "DeleteButton w-auto"
152+ variant = "danger"
153+ onClick = { ( ) => deleteItemHandler ( ) }
154+ >
155+ < span className = "d-none d-md-inline" > Delete</ span >
156+ < MdOutlineDeleteForever className = " d-block d-md-none" />
157+ </ Button >
158+ </ section >
159+ </ section >
141160 </ div >
142161 ) ;
143162}
0 commit comments