AdminGoodListHeader.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import { AddButton } from "../../common/AddButton";
  2. import { TableCell, TableRow, TableSortLabel } from "@mui/material";
  3. import { useNavigate } from "react-router-dom";
  4. const AdminGoodListHeader = ({ onSortChange, sort }) => {
  5. const navigate = useNavigate();
  6. return (
  7. <TableRow className="AdminGoodListHeader">
  8. <TableCell scope="col">
  9. <TableSortLabel
  10. active={sort === "_id" || sort === "-_id"}
  11. direction={sort === "_id" ? "asc" : "desc"}
  12. onClick={() => onSortChange(sort === "_id" ? "-_id" : "_id")}
  13. >
  14. #
  15. </TableSortLabel>
  16. </TableCell>
  17. <TableCell scope="col">
  18. <TableSortLabel
  19. active={sort === "name" || sort === "-name"}
  20. direction={sort === "name" ? "asc" : "desc"}
  21. onClick={() => onSortChange(sort === "name" ? "-name" : "name")}
  22. >
  23. Назва
  24. </TableSortLabel>
  25. </TableCell>
  26. <TableCell scope="col">Зображення</TableCell>
  27. <TableCell scope="col">
  28. <TableSortLabel
  29. active={sort === "price" || sort === "-price"}
  30. direction={sort === "price" ? "asc" : "desc"}
  31. onClick={() => onSortChange(sort === "price" ? "-price" : "price")}
  32. >
  33. Ціна
  34. </TableSortLabel>
  35. </TableCell>
  36. <TableCell scope="col">
  37. <TableSortLabel
  38. active={sort === "amount" || sort === "-amount"}
  39. direction={sort === "amount" ? "asc" : "desc"}
  40. onClick={() => onSortChange(sort === "amount" ? "-amount" : "amount")}
  41. >
  42. Кількість
  43. </TableSortLabel>
  44. </TableCell>
  45. <TableCell scope="col">Категорії</TableCell>
  46. <TableCell scope="col">
  47. <AddButton
  48. onClick={() => {
  49. navigate("/admin/good/");
  50. }}
  51. />
  52. </TableCell>
  53. </TableRow>
  54. );
  55. };
  56. export { AdminGoodListHeader };