import Card from "@material-ui/core/Card"; import { createStyles, 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 TableHead from "@material-ui/core/TableHead"; import TableRow from "@material-ui/core/TableRow"; import classNames from "classnames"; import React from "react"; import Skeleton from "@saleor/components/Skeleton"; import i18n from "../../../i18n"; import { maybe, renderCollection } from "../../../misc"; import { CountryList_shop_countries } from "../../types/CountryList"; const styles = createStyles({ tableRow: { cursor: "pointer" }, textRight: { textAlign: "right" } }); interface CountryListProps extends WithStyles { countries: CountryList_shop_countries[]; onRowClick: (code: string) => void; } const CountryList = withStyles(styles, { name: "CountryList" })( ({ classes, onRowClick, countries }: CountryListProps) => ( {i18n.t("Country Code", { context: "object" })} {i18n.t("Country Name", { context: "object" })} {i18n.t("Reduced Tax Rates", { context: "object" })} {renderCollection( countries, country => ( onRowClick(country.code) : undefined} key={country ? country.code : "skeleton"} > {maybe(() => country.code, )} {maybe(() => country.country, )} {maybe( () => country.vat.reducedRates.length, )} ), () => ( {i18n.t("No countries found")} ) )}
) ); CountryList.displayName = "CountryList"; export default CountryList;