diff --git a/Lab5/Bookfill/src/components/search/Search.jsx b/Lab5/Bookfill/src/components/search/Search.jsx index 1756c19..5c14935 100644 --- a/Lab5/Bookfill/src/components/search/Search.jsx +++ b/Lab5/Bookfill/src/components/search/Search.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types'; import { Heart } from 'react-bootstrap-icons'; import '../lines/table/LinesTableRow.css'; -const Direction = ({ index, line, onAddCart }) => { +const Search = ({ index, line, onAddCart }) => { const handleAnchorClick = (event, action) => { event.preventDefault(); action(); @@ -11,7 +11,6 @@ const Direction = ({ index, line, onAddCart }) => { {index + 1} {line.book_name} - {line.type.name} {line.author_name} {parseFloat(line.price).toFixed(2)} {line.book_name} @@ -20,10 +19,10 @@ const Direction = ({ index, line, onAddCart }) => { ); }; -Direction.propTypes = { +Search.propTypes = { index: PropTypes.number, line: PropTypes.object, onAddCart: PropTypes.func, }; -export default Direction; +export default Search; diff --git a/Lab5/Bookfill/src/components/search/Searchs.jsx b/Lab5/Bookfill/src/components/search/Searchs.jsx index bb75eb9..1614aca 100644 --- a/Lab5/Bookfill/src/components/search/Searchs.jsx +++ b/Lab5/Bookfill/src/components/search/Searchs.jsx @@ -1,16 +1,13 @@ import { useState } from 'react'; import TableDirect from './TableSearch.jsx'; -import Select from '../input/Select.jsx'; -import Direction from './Search.jsx'; -import useLines from '../lines/hooks/LinesHook'; +import Search from './Search.jsx'; +import useSearch from './searchHooks/SearchHooks'; import useCart from '../cart/CartHook'; import Input from '../input/Input.jsx'; -import useTypeFilter from '../lines/hooks/LinesFilterHook'; -const Directions = () => { - const { types, currentFilter, handleFilterChange } = useTypeFilter(); - const { lines } = useLines(currentFilter); +const Searchs = () => { const [searchValue, setSearchValue] = useState(''); + const { lines } = useSearch(searchValue); const { addToCart } = useCart(); return ( @@ -18,22 +15,15 @@ const Directions = () => {
setSearchValue(e.target.value)} type='text' required /> -