diff --git a/src/components/SearchForm.jsx b/src/components/SearchForm.jsx new file mode 100644 index 0000000..e69de29 diff --git a/src/views/List.jsx b/src/views/List.jsx index 4b341e3..5e7f01c 100644 --- a/src/views/List.jsx +++ b/src/views/List.jsx @@ -1,11 +1,52 @@ import { ListItem } from '../components'; +import { useState } from 'react'; export function List({ data }) { + const [searchItem, setSearchItem] = useState(''); + + const handleSearch = (e) => { + e.preventDefault(); + setSearchItem(e.target.value); + }; + + const clearSearch = () => { + setSearchItem(''); + }; + + const filterItems = data.filter((item) => + item.name.toLowerCase().includes(searchItem.toLocaleLowerCase()), + ); + return ( <>

Hello from the /list page!

+
+
+ + + {searchItem && ( + + )} + {searchItem && ( + + )} +
+
+