import Card from "@material-ui/core/Card"; import { createStyles, Theme, withStyles, WithStyles } from "@material-ui/core/styles"; import Table from "@material-ui/core/Table"; import TableBody from "@material-ui/core/TableBody"; import TableCell from "@material-ui/core/TableCell"; import TableFooter from "@material-ui/core/TableFooter"; import TableRow from "@material-ui/core/TableRow"; import React from "react"; import Checkbox from "@saleor/components/Checkbox"; import Skeleton from "@saleor/components/Skeleton"; import StatusLabel from "@saleor/components/StatusLabel"; import TableHead from "@saleor/components/TableHead"; import TablePagination from "@saleor/components/TablePagination"; import i18n from "../../../i18n"; import { maybe, renderCollection } from "../../../misc"; import { ListActions, ListProps } from "../../../types"; import { CollectionList_collections_edges_node } from "../../types/CollectionList"; const styles = (theme: Theme) => createStyles({ [theme.breakpoints.up("lg")]: { colAvailability: { width: 240 }, colName: {}, colProducts: { width: 240 } }, colAvailability: {}, colName: {}, colProducts: { textAlign: "center" }, tableRow: { cursor: "pointer" as "pointer" } }); interface CollectionListProps extends ListProps, ListActions, WithStyles { collections: CollectionList_collections_edges_node[]; } const CollectionList = withStyles(styles, { name: "CollectionList" })( ({ classes, collections, disabled, onNextPage, onPreviousPage, onRowClick, pageInfo, isChecked, selected, toggle, toggleAll, toolbar }: CollectionListProps) => ( {i18n.t("Category Name", { context: "table cell" })} {i18n .t("No. Products", { context: "table cell" }) .replace(" ", "\xa0")} {i18n.t("Availability", { context: "table cell" })} {renderCollection( collections, collection => { const isSelected = collection ? isChecked(collection.id) : false; return ( toggle(collection.id)} /> {maybe( () => collection.name, )} {maybe( () => collection.products.totalCount, )} {maybe( () => ( ), )} ); }, () => ( {i18n.t("No collections found")} ) )}
) ); CollectionList.displayName = "CollectionList"; export default CollectionList;