import { ProductCollection } from "@medusajs/medusa" import { useMemo } from "react" import { Column, HeaderGroup, Row } from "react-table" import { useTranslation } from "react-i18next" import SortingIcon from "../../../../../../components/fundamentals/icons/sorting-icon" import Table from "../../../../../../components/molecules/table" export const CollectionRow = ({ row }: { row: Row }) => { return ( {row.cells.map((cell) => { return ( {cell.render("Cell")} ) })} ) } export const CollectionsHeader = ({ headerGroup, }: { headerGroup: HeaderGroup }) => { return ( {headerGroup.headers.map((col) => ( {col.render("Header")} ))} ) } export const useCollectionColumns = () => { const { t } = useTranslation() const columns = useMemo[]>(() => { return [ { Header: () => (
{t("shared-title", "Title")}
), accessor: "title", Cell: ({ row: { original } }) => { return {original.title} }, }, { Header: () => (
{t("shared-products", "Products")}
), id: "products", accessor: (row) => row?.products?.length, Cell: ({ cell: { value } }) => { return
{value}
}, }, ] }, []) return columns }