11import { useEffect , useState } from 'react' ;
22import { Link } from 'react-router-dom' ;
33import { ListItem , AddItem } from '../components' ;
4+ import { FiDelete } from 'react-icons/fi' ;
45import {
56 comparePurchaseUrgency ,
67 updateItem ,
@@ -9,6 +10,7 @@ import {
910
1011export function List ( { data, listPath, lists } ) {
1112 const [ searchItem , setSearchItem ] = useState ( '' ) ;
13+ // eslint-disable-next-line no-unused-vars
1214 const [ items , setItems ] = useState ( [ ] ) ;
1315
1416 const listTitle = listPath ? listPath . split ( '/' ) [ 1 ] : null ;
@@ -66,8 +68,8 @@ export function List({ data, listPath, lists }) {
6668 } ;
6769
6870 return (
69- < >
70- < h2 > { fixedListTitle } </ h2 >
71+ < div className = "container mx-auto px-4 min-h-screen flex flex-col items-center justify-center justify-items-center mb-40" >
72+ < h2 className = "text-3xl" > { fixedListTitle } </ h2 >
7173 { ! listPath && lists . length > 0 && data . length > 0 && (
7274 < p >
7375 Oops! No list selected yet. Head to the < Link to = "/" > home page</ Link > { ' ' }
@@ -99,20 +101,29 @@ export function List({ data, listPath, lists }) {
99101
100102 < form onSubmit = { handleSearch } >
101103 < div >
102- < label htmlFor = "search-item-in-list" > Search items:</ label >
103- < input
104- onChange = { handleSearch }
105- type = "text"
106- id = "search-item-in-list"
107- value = { searchItem }
108- placeholder = "Search an item..."
109- aria-label = "Search for items"
110- />
111- { searchItem && (
112- < button type = "button" onClick = { clearSearch } >
113- x
114- </ button >
115- ) }
104+ < span className = "flex flex-col m-2 p-2 justify-evenly" >
105+ < label
106+ htmlFor = "search-item-in-list"
107+ className = "text-center m-4"
108+ >
109+ { ' ' }
110+ Search items:
111+ </ label >
112+ < input
113+ className = "border"
114+ onChange = { handleSearch }
115+ type = "text"
116+ id = "search-item-in-list"
117+ value = { searchItem }
118+ placeholder = "Search an item..."
119+ aria-label = "Search for items"
120+ />
121+ { searchItem && (
122+ < button type = "button" onClick = { clearSearch } >
123+ < FiDelete />
124+ </ button >
125+ ) }
126+ </ span >
116127 </ div >
117128 </ form >
118129
@@ -152,6 +163,6 @@ export function List({ data, listPath, lists }) {
152163 ) }
153164 </ >
154165 ) }
155- </ >
166+ </ div >
156167 ) ;
157168}
0 commit comments