diff --git a/Lab5/Bookfill/src/components/directions/Direction.jsx b/Lab5/Bookfill/src/components/directions/Direction.jsx
new file mode 100644
index 0000000..1756c19
--- /dev/null
+++ b/Lab5/Bookfill/src/components/directions/Direction.jsx
@@ -0,0 +1,29 @@
+import PropTypes from 'prop-types';
+import { Heart } from 'react-bootstrap-icons';
+import '../lines/table/LinesTableRow.css';
+
+const Direction = ({ index, line, onAddCart }) => {
+ const handleAnchorClick = (event, action) => {
+ event.preventDefault();
+ action();
+ };
+ return (
+
+ {index + 1} |
+ {line.book_name} |
+ {line.type.name} |
+ {line.author_name} |
+ {parseFloat(line.price).toFixed(2)} |
+ |
+ handleAnchorClick(event, onAddCart)}> |
+
+ );
+};
+
+Direction.propTypes = {
+ index: PropTypes.number,
+ line: PropTypes.object,
+ onAddCart: PropTypes.func,
+};
+
+export default Direction;
diff --git a/Lab5/Bookfill/src/components/directions/Directions.jsx b/Lab5/Bookfill/src/components/directions/Directions.jsx
new file mode 100644
index 0000000..5c69f28
--- /dev/null
+++ b/Lab5/Bookfill/src/components/directions/Directions.jsx
@@ -0,0 +1,45 @@
+import { useState } from 'react';
+import TableDirect from './TableDirect.jsx';
+import Select from '../input/Select.jsx';
+import Direction from './Direction.jsx';
+import useLines from '../lines/hooks/LinesHook';
+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 [searchValue, setSearchValue] = useState('');
+ const { addToCart } = useCart();
+
+ return (
+ <>
+
+ setSearchValue(e.target.value)}
+ type='text' required />
+
+
+
+
+ {
+ lines.map((line, index) => {
+ if (searchValue === ''
+ || line.book_name?.toLowerCase().includes(searchValue.toLowerCase())
+ || line.author?.toLowerCase().includes(searchValue.toLowerCase())) {
+ return addToCart(line)} />;
+ }
+ return null;
+ })
+ }
+
+
+ >
+ );
+};
+
+export default Directions;
diff --git a/Lab5/Bookfill/src/components/directions/TableDirect.jsx b/Lab5/Bookfill/src/components/directions/TableDirect.jsx
new file mode 100644
index 0000000..7a89a01
--- /dev/null
+++ b/Lab5/Bookfill/src/components/directions/TableDirect.jsx
@@ -0,0 +1,27 @@
+import PropTypes from 'prop-types';
+import { Table } from 'react-bootstrap';
+
+const TableDirect = ({ children }) => {
+ return (
+
+
+
+ № |
+ Name |
+ Category |
+ Author |
+ Price |
+
+
+
+ {children}
+
+
+ );
+};
+
+TableDirect.propTypes = {
+ children: PropTypes.node,
+};
+
+export default TableDirect;
diff --git a/Lab5/Bookfill/src/pages/Search.jsx b/Lab5/Bookfill/src/pages/Search.jsx
index 8ade9a9..1072cc3 100644
--- a/Lab5/Bookfill/src/pages/Search.jsx
+++ b/Lab5/Bookfill/src/pages/Search.jsx
@@ -1,57 +1,11 @@
-import {
- Form, InputGroup, FormControl, Button, Dropdown, Table,
-} from 'react-bootstrap';
+import './pages.css';
+import Directions from '../components/directions/Directions.jsx';
const Search = () => {
return (
-
+ <>
+
+ >
);
};