SearchCategoryResultItem.js 625 B

12345678910111213141516
  1. import { Link } from "react-router-dom";
  2. import { Stack, Typography } from "@mui/material";
  3. export const SearchCategoryResultItem = ({ category, onClick, link = "" } = {}) => {
  4. const { _id = null, name = "" } = category || {};
  5. return (
  6. <Link className="Link" to={`${link}${_id}/`}>
  7. <Stack direction="row" className="SearchCategoryResultItem" onClick={() => onClick && onClick()}>
  8. <Typography sx={{ flexGrow: 1 }}>{name.length > 30 ? `${name.substring(0, 30)}...` : name}</Typography>
  9. <Typography>{_id}</Typography>
  10. </Stack>
  11. </Link>
  12. );
  13. };