import { Theme } 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 makeStyles from "@material-ui/styles/makeStyles"; import React from "react"; import { FormattedMessage } from "react-intl"; import Checkbox from "@saleor/components/Checkbox"; import Skeleton from "@saleor/components/Skeleton"; import TableHead from "@saleor/components/TableHead"; import TablePagination from "@saleor/components/TablePagination"; import { renderCollection } from "@saleor/misc"; import { ListActions, ListProps } from "@saleor/types"; import { translateBoolean } from "@saleor/utils/i18n"; import { AttributeList_attributes_edges_node } from "../../types/AttributeList"; export interface AttributeListProps extends ListProps, ListActions { attributes: AttributeList_attributes_edges_node[]; } const useStyles = makeStyles((theme: Theme) => ({ [theme.breakpoints.up("lg")]: { colFaceted: { width: 150 }, colName: { width: "auto" }, colSearchable: { width: 150 }, colSlug: { width: 200 }, colVisible: { width: 150 } }, colFaceted: { textAlign: "center" }, colName: {}, colSearchable: { textAlign: "center" }, colSlug: {}, colVisible: { textAlign: "center" }, link: { cursor: "pointer" } })); const numberOfColumns = 6; const AttributeList: React.StatelessComponent = ({ attributes, disabled, isChecked, onNextPage, onPreviousPage, onRowClick, pageInfo, selected, toggle, toggleAll, toolbar }) => { const classes = useStyles({}); return ( {renderCollection( attributes, attribute => { const isSelected = attribute ? isChecked(attribute.id) : false; return ( toggle(attribute.id)} /> {attribute ? attribute.slug : } {attribute ? attribute.name : } {attribute ? ( translateBoolean(attribute.visibleInStorefront) ) : ( )} {attribute ? ( translateBoolean(attribute.filterableInDashboard) ) : ( )} {attribute ? ( translateBoolean(attribute.filterableInStorefront) ) : ( )} ); }, () => ( ) )}
); }; AttributeList.displayName = "AttributeList"; export default AttributeList;