Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add basic filter-tabs layout for products

Lukasz Szewczykf552ac62eaed
diff --git a/saleor/static/dashboard-next/products/components/ProductListCard/ProductListCard.tsx b/saleor/static/dashboard-next/products/components/ProductListCard/ProductListCard.tsx
index 96eae555f9..efde323f2a 100644
--- a/saleor/static/dashboard-next/products/components/ProductListCard/ProductListCard.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductListCard/ProductListCard.tsx
@@ -9,6 +9,7 @@ import PageHeader from "../../../components/PageHeader";
import ProductList from "../../../components/ProductList";
import i18n from "../../../i18n";
import { PageListProps } from "../../../types";
+import ProductListFilter from "../ProductListFilter";
interface ProductListCardProps extends PageListProps {
products: CategoryDetails_category_products_edges_node[];
@@ -32,6 +33,7 @@ export const ProductListCard: React.StatelessComponent<
</Button>
</PageHeader>
<Card>
+ <ProductListFilter />
<ProductList
products={products}
disabled={disabled}
diff --git a/saleor/static/dashboard-next/products/components/ProductListFilter/ProductListFilter.tsx b/saleor/static/dashboard-next/products/components/ProductListFilter/ProductListFilter.tsx
new file mode 100644
index 0000000000..833b76dc6a
--- /dev/null
+++ b/saleor/static/dashboard-next/products/components/ProductListFilter/ProductListFilter.tsx
@@ -0,0 +1,69 @@
+import { withStyles } from "@material-ui/core/styles";
+import ClearIcon from "@material-ui/icons/Clear";
+// import Typographt from "@material-ui/core/Typography";
+import Tab from "@material-ui/core/Tab";
+import Tabs from "@material-ui/core/Tabs";
+import * as React from "react";
+
+// import i18n from "../../../i18n";
+
+interface ProductListFilterProps {
+ disabled?: boolean;
+}
+
+const decorate = withStyles(theme => ({
+ clearIcon: {
+color: "#b2b2b2",
+heigh: "18px,
+wodth" 18px"
+ }
+ tabLabel: {
+ color: "#616161",
+ fontSize: "0.875rem"
+ },
+ tabRoot: {
+ minWidth: "80px",
+ opacity: 1,
+ paddingTop: `${theme.spacing.unit * 1}px`,
+ textTransform: "initial" as "initial"
+ },
+ tabWrapper: {
+ flexDirection: "row-reverse" as "row-reverse"
+ },
+ tabsRoot: {
+ borderBottom: "1px solid #e0e0e0",
+ paddingLeft: `${theme.spacing.unit * 3}px`
+ }
+}));
+
+const ProductListFilter = decorate<ProductListFilterProps>(({ classes }) => (
+ <Tabs className={classes.tabsRoot} value={0} indicatorColor={"primary"}>
+ <Tab
+ disableRipple
+ classes={{ root: classes.tabRoot, label: classes.tabLabel }}
+ label={"All Products"}
+ />
+ <Tab
+ disableRipple
+ classes={{ root: classes.tabRoot, label: classes.tabLabel }}
+ label={"Available"}
+ />
+ <Tab
+ disableRipple
+ classes={{ root: classes.tabRoot, label: classes.tabLabel }}
+ label={"Out of stock"}
+ />
+ <Tab
+ disableRipple
+ classes={{
+ label: classes.tabLabel,
+ root: classes.tabRoot,
+ wrapper: classes.tabWrapper
+ }}
+ label={"Custom filter"}
+ icon={<ClearIcon />}
+ />
+ </Tabs>
+));
+ProductListFilter.displayName = "ProductListFilter";
+export default ProductListFilter;
diff --git a/saleor/static/dashboard-next/products/components/ProductListFilter/index.ts b/saleor/static/dashboard-next/products/components/ProductListFilter/index.ts
new file mode 100644
index 0000000000..c251bdbef4
--- /dev/null
+++ b/saleor/static/dashboard-next/products/components/ProductListFilter/index.ts
@@ -0,0 +1,2 @@
+export { default } from "./ProductListFilter";
+export * from "./ProductListFilter";