Skip to content

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

Use const cell width in tables

dominik-zeglen0a8b1d54d49b
diff --git a/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx b/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx
index 83e6d4c771..cfe76d740a 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx
@@ -1,7 +1,12 @@
import Button from "@material-ui/core/Button";
import Card from "@material-ui/core/Card";
import Checkbox from "@material-ui/core/Checkbox";
-import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";
+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";
@@ -17,17 +22,30 @@ import i18n from "../../../i18n";
import { renderCollection } from "../../../misc";
import { ListActions, ListProps } from "../../../types";
-const styles = createStyles({
- centerText: {
- textAlign: "center"
- },
- tableRow: {
- cursor: "pointer"
- },
- wideColumn: {
- width: "100%"
- }
-});
+const styles = (theme: Theme) =>
+ createStyles({
+ [theme.breakpoints.up("lg")]: {
+ colName: {
+ width: 840
+ },
+ colProducts: {
+ width: 160
+ },
+ colSubcategories: {
+ width: 160
+ }
+ },
+ colName: {},
+ colProducts: {
+ textAlign: "center"
+ },
+ colSubcategories: {
+ textAlign: "center"
+ },
+ tableRow: {
+ cursor: "pointer"
+ }
+ });
interface CategoryListProps
extends ListProps,
@@ -78,13 +96,13 @@ const CategoryList = withStyles(styles, { name: "CategoryList" })(
<TableHead selected={selected} toolbar={toolbar}>
<TableRow>
<TableCell />
- <TableCell className={classes.wideColumn}>
+ <TableCell className={classes.colName}>
{i18n.t("Category Name", { context: "object" })}
</TableCell>
- <TableCell className={classes.centerText}>
+ <TableCell className={classes.colSubcategories}>
{i18n.t("Subcategories", { context: "object" })}
</TableCell>
- <TableCell className={classes.centerText}>
+ <TableCell className={classes.colProducts}>
{i18n
.t("No. Products", { context: "object" })
.replace(" ", "\xa0")}
@@ -129,10 +147,10 @@ const CategoryList = withStyles(styles, { name: "CategoryList" })(
}}
/>
</TableCell>
- <TableCell className={classes.wideColumn}>
+ <TableCell className={classes.colName}>
{category && category.name ? category.name : <Skeleton />}
</TableCell>
- <TableCell className={classes.centerText}>
+ <TableCell className={classes.colSubcategories}>
{category &&
category.children &&
category.children.totalCount !== undefined ? (
@@ -141,7 +159,7 @@ const CategoryList = withStyles(styles, { name: "CategoryList" })(
<Skeleton />
)}
</TableCell>
- <TableCell className={classes.centerText}>
+ <TableCell className={classes.colProducts}>
{category &&
category.products &&
category.products.totalCount !== undefined ? (
diff --git a/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx b/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx
index 62070e01de..84e2a0339b 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx
@@ -1,6 +1,11 @@
import Card from "@material-ui/core/Card";
import Checkbox from "@material-ui/core/Checkbox";
-import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";
+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";
@@ -17,20 +22,26 @@ import { maybe, renderCollection } from "../../../misc";
import { ListActions, ListProps } from "../../../types";
import { CollectionList_collections_edges_node } from "../../types/CollectionList";
-const styles = createStyles({
- name: {
- width: "50%"
- },
- tableRow: {
- cursor: "pointer" as "pointer"
- },
- textCenter: {
- textAlign: "center" as "center"
- },
- textLeft: {
- textAlign: "left" as "left"
- }
-});
+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,
@@ -58,15 +69,15 @@ const CollectionList = withStyles(styles, { name: "CollectionList" })(
<TableHead selected={selected} toolbar={toolbar}>
<TableRow>
<TableCell />
- <TableCell className={classes.name}>
+ <TableCell className={classes.colName}>
{i18n.t("Category Name", { context: "table cell" })}
</TableCell>
- <TableCell className={classes.textCenter}>
+ <TableCell className={classes.colProducts}>
{i18n
.t("No. Products", { context: "table cell" })
.replace(" ", "\xa0")}
</TableCell>
- <TableCell className={classes.textLeft}>
+ <TableCell className={classes.colAvailability}>
{i18n.t("Availability", { context: "table cell" })}
</TableCell>
</TableRow>
@@ -108,19 +119,19 @@ const CollectionList = withStyles(styles, { name: "CollectionList" })(
}}
/>
</TableCell>
- <TableCell>
+ <TableCell className={classes.colName}>
{maybe<React.ReactNode>(
() => collection.name,
<Skeleton />
)}
</TableCell>
- <TableCell className={classes.textCenter}>
+ <TableCell className={classes.colProducts}>
{maybe<React.ReactNode>(
() => collection.products.totalCount,
<Skeleton />
)}
</TableCell>
- <TableCell className={classes.textLeft}>
+ <TableCell className={classes.colAvailability}>
{maybe(
() => (
<StatusLabel
diff --git a/saleor/static/dashboard-next/components/ProductList/ProductList.tsx b/saleor/static/dashboard-next/components/ProductList/ProductList.tsx
index 73d179a6b0..da17328c7d 100644
--- a/saleor/static/dashboard-next/components/ProductList/ProductList.tsx
+++ b/saleor/static/dashboard-next/components/ProductList/ProductList.tsx
@@ -25,11 +25,31 @@ import TablePagination from "../TablePagination";
const styles = (theme: Theme) =>
createStyles({
+ [theme.breakpoints.up("lg")]: {
+ colName: {
+ width: 430
+ },
+ colPrice: {
+ width: 200
+ },
+ colPublished: {
+ width: 200
+ },
+ colType: {
+ width: 200
+ }
+ },
avatarCell: {
paddingLeft: theme.spacing.unit * 2,
paddingRight: 0,
width: theme.spacing.unit * 5
},
+ colName: {},
+ colPrice: {
+ textAlign: "right"
+ },
+ colPublished: {},
+ colType: {},
link: {
cursor: "pointer"
},
@@ -67,12 +87,16 @@ export const ProductList = withStyles(styles, { name: "ProductList" })(
<TableRow>
<TableCell />
<TableCell />
- <TableCell className={classes.textLeft}>
+ <TableCell className={classes.colName}>
{i18n.t("Name", { context: "object" })}
</TableCell>
- <TableCell>{i18n.t("Type", { context: "object" })}</TableCell>
- <TableCell>{i18n.t("Published", { context: "object" })}</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colType}>
+ {i18n.t("Type", { context: "object" })}
+ </TableCell>
+ <TableCell className={classes.colPublished}>
+ {i18n.t("Published", { context: "object" })}
+ </TableCell>
+ <TableCell className={classes.colPrice}>
{i18n.t("Price", { context: "object" })}
</TableCell>
</TableRow>
@@ -118,17 +142,17 @@ export const ProductList = withStyles(styles, { name: "ProductList" })(
<TableCellAvatar
thumbnail={maybe(() => product.thumbnail.url)}
/>
- <TableCell className={classes.textLeft}>
+ <TableCell className={classes.colName}>
{product ? product.name : <Skeleton />}
</TableCell>
- <TableCell>
+ <TableCell className={classes.colType}>
{product && product.productType ? (
product.productType.name
) : (
<Skeleton />
)}
</TableCell>
- <TableCell>
+ <TableCell className={classes.colPublished}>
{product &&
product.availability &&
product.availability.available !== undefined ? (
@@ -148,7 +172,7 @@ export const ProductList = withStyles(styles, { name: "ProductList" })(
<Skeleton />
)}
</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colPrice}>
{product &&
product.price &&
product.price.amount !== undefined &&
diff --git a/saleor/static/dashboard-next/components/TableCellAvatar/TableCellAvatar.tsx b/saleor/static/dashboard-next/components/TableCellAvatar/TableCellAvatar.tsx
index c940d32bbf..f540cbcd63 100644
--- a/saleor/static/dashboard-next/components/TableCellAvatar/TableCellAvatar.tsx
+++ b/saleor/static/dashboard-next/components/TableCellAvatar/TableCellAvatar.tsx
@@ -22,9 +22,8 @@ const styles = (theme: Theme) =>
padding: theme.spacing.unit / 2
},
root: {
- // paddingLeft: theme.spacing.unit * 3,
paddingRight: theme.spacing.unit * 3,
- width: "1%"
+ width: 64
}
});
diff --git a/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx b/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx
index 76d12393dc..aa50f609a1 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx
@@ -1,6 +1,11 @@
import Card from "@material-ui/core/Card";
import Checkbox from "@material-ui/core/Checkbox";
-import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";
+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";
@@ -16,17 +21,24 @@ import { getUserName, maybe, renderCollection } from "../../../misc";
import { ListActions, ListProps } from "../../../types";
import { ListCustomers_customers_edges_node } from "../../types/ListCustomers";
-const styles = createStyles({
- tableRow: {
- cursor: "pointer"
- },
- textCenter: {
- textAlign: "center"
- },
- wideCell: {
- width: "60%"
- }
-});
+const styles = (theme: Theme) =>
+ createStyles({
+ [theme.breakpoints.up("lg")]: {
+ colEmail: {},
+ colName: {},
+ colOrders: {
+ width: 200
+ }
+ },
+ colEmail: {},
+ colName: {},
+ colOrders: {
+ textAlign: "center"
+ },
+ tableRow: {
+ cursor: "pointer"
+ }
+ });
export interface CustomerListProps
extends ListProps,
@@ -54,13 +66,13 @@ const CustomerList = withStyles(styles, { name: "CustomerList" })(
<TableHead selected={selected} toolbar={toolbar}>
<TableRow>
<TableCell />
- <TableCell>
+ <TableCell className={classes.colName}>
{i18n.t("Customer Name", { context: "table header" })}
</TableCell>
- <TableCell className={classes.wideCell}>
+ <TableCell className={classes.colEmail}>
{i18n.t("Customer e-mail", { context: "table header" })}
</TableCell>
- <TableCell className={classes.textCenter}>
+ <TableCell className={classes.colOrders}>
{i18n.t("Orders", { context: "table header" })}
</TableCell>
</TableRow>
@@ -103,11 +115,13 @@ const CustomerList = withStyles(styles, { name: "CustomerList" })(
}}
/>
</TableCell>
- <TableCell>{getUserName(customer)}</TableCell>
- <TableCell>
+ <TableCell className={classes.colName}>
+ {getUserName(customer)}
+ </TableCell>
+ <TableCell className={classes.colEmail}>
{maybe<React.ReactNode>(() => customer.email, <Skeleton />)}
</TableCell>
- <TableCell className={classes.textCenter}>
+ <TableCell className={classes.colOrders}>
{maybe<React.ReactNode>(
() => customer.orders.totalCount,
<Skeleton />
diff --git a/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsx b/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsx
index a3b3df68f3..c612c0416f 100644
--- a/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsx
+++ b/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsx
@@ -36,6 +36,18 @@ export interface SaleProductsProps extends ListProps, ListActions {
const styles = (theme: Theme) =>
createStyles({
+ [theme.breakpoints.up("lg")]: {
+ colName: {},
+ colPublished: {
+ width: 150
+ },
+ colType: {
+ width: 200
+ }
+ },
+ colName: {},
+ colPublished: {},
+ colType: {},
iconCell: {
"&:last-child": {
paddingRight: 0
@@ -44,12 +56,6 @@ const styles = (theme: Theme) =>
},
tableRow: {
cursor: "pointer"
- },
- textRight: {
- textAlign: "right"
- },
- wideColumn: {
- width: "40%"
}
});
const DiscountProducts = withStyles(styles, {
@@ -86,13 +92,13 @@ const DiscountProducts = withStyles(styles, {
<TableRow>
<TableCell />
<TableCell />
- <TableCell className={classes.wideColumn}>
+ <TableCell className={classes.colName}>
{i18n.t("Product name")}
</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colType}>
{i18n.t("Product Type")}
</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colPublished}>
{i18n.t("Published")}
</TableCell>
<TableCell />
@@ -138,16 +144,16 @@ const DiscountProducts = withStyles(styles, {
<TableCellAvatar
thumbnail={maybe(() => product.thumbnail.url)}
/>
- <TableCell>
+ <TableCell className={classes.colName}>
{maybe<React.ReactNode>(() => product.name, <Skeleton />)}
</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colType}>
{maybe<React.ReactNode>(
() => product.productType.name,
<Skeleton />
)}
</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colPublished}>
{product && product.isPublished !== undefined ? (
<StatusLabel
label={
diff --git a/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsx b/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsx
index 60a9f8c2ba..6f2eaaef0a 100644
--- a/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsx
+++ b/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsx
@@ -1,6 +1,11 @@
import Card from "@material-ui/core/Card";
import Checkbox from "@material-ui/core/Checkbox";
-import { createStyles, WithStyles, withStyles } from "@material-ui/core/styles";
+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";
@@ -25,17 +30,34 @@ export interface SaleListProps extends ListProps, ListActions {
sales: SaleList_sales_edges_node[];
}
-const styles = createStyles({
- tableRow: {
- cursor: "pointer"
- },
- textRight: {
- textAlign: "right"
- },
- wideColumn: {
- width: "40%"
- }
-});
+const styles = (theme: Theme) =>
+ createStyles({
+ [theme.breakpoints.up("lg")]: {
+ colEnd: {
+ width: 250
+ },
+ colName: {},
+ colStart: {
+ width: 250
+ },
+ colValue: {
+ width: 200
+ }
+ },
+ colEnd: {
+ textAlign: "right"
+ },
+ colName: {},
+ colStart: {
+ textAlign: "right"
+ },
+ colValue: {
+ textAlign: "right"
+ },
+ tableRow: {
+ cursor: "pointer"
+ }
+ });
const SaleList = withStyles(styles, {
name: "SaleList"
@@ -59,22 +81,22 @@ const SaleList = withStyles(styles, {
<TableHead selected={selected} toolbar={toolbar}>
<TableRow>
<TableCell />
- <TableCell className={classes.wideColumn}>
+ <TableCell className={classes.colName}>
{i18n.t("Name", {
context: "sale list table header"
})}
</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colStart}>
{i18n.t("Starts", {
context: "sale list table header"
})}
</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colEnd}>
{i18n.t("Ends", {
context: "sale list table header"
})}
</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colValue}>
{i18n.t("Value", {
context: "sale list table header"
})}
@@ -119,17 +141,17 @@ const SaleList = withStyles(styles, {
}}
/>
</TableCell>
- <TableCell>
+ <TableCell className={classes.colName}>
{maybe<React.ReactNode>(() => sale.name, <Skeleton />)}
</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colStart}>
{sale && sale.startDate ? (
<Date date={sale.startDate} />
) : (
<Skeleton />
)}
</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colEnd}>
{sale && sale.endDate ? (
<Date date={sale.endDate} />
) : sale && sale.endDate === null ? (
@@ -139,7 +161,7 @@ const SaleList = withStyles(styles, {
)}
</TableCell>
<TableCell
- className={classes.textRight}
+ className={classes.colValue}
onClick={sale ? onRowClick(sale.id) : undefined}
>
{sale && sale.type && sale.value ? (
diff --git a/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx b/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx
index 9d244419f8..fefa59e780 100644
--- a/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx
+++ b/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx
@@ -1,6 +1,11 @@
import Card from "@material-ui/core/Card";
import Checkbox from "@material-ui/core/Checkbox";
-import { createStyles, WithStyles, withStyles } from "@material-ui/core/styles";
+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";
@@ -25,17 +30,49 @@ export interface VoucherListProps extends ListProps, ListActions {
vouchers: VoucherList_vouchers_edges_node[];
}
-const styles = createStyles({
- tableRow: {
- cursor: "pointer"
- },
- textRight: {
- textAlign: "right"
- },
- wideColumn: {
- width: "40%"
- }
-});
+const styles = (theme: Theme) =>
+ createStyles({
+ [theme.breakpoints.up("lg")]: {
+ colEnd: {
+ width: 180
+ },
+ colMinSpent: {
+ width: 150
+ },
+ colName: {},
+ colStart: {
+ width: 180
+ },
+ colUses: {
+ width: 150
+ },
+ colValue: {
+ width: 150
+ }
+ },
+ colEnd: {
+ textAlign: "right"
+ },
+ colMinSpent: {
+ textAlign: "right"
+ },
+ colName: {},
+ colStart: {
+ textAlign: "right"
+ },
+ colUses: {
+ textAlign: "right"
+ },
+ colValue: {
+ textAlign: "right"
+ },
+ tableRow: {
+ cursor: "pointer"
+ },
+ textRight: {
+ textAlign: "right"
+ }
+ });
const VoucherList = withStyles(styles, {
name: "VoucherList"
@@ -59,32 +96,32 @@ const VoucherList = withStyles(styles, {
<TableHead selected={selected} toolbar={toolbar}>
<TableRow>
<TableCell />
- <TableCell className={classes.wideColumn}>
+ <TableCell className={classes.colName}>
{i18n.t("Name", {
context: "voucher list table header"
})}
</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colMinSpent}>
{i18n.t("Min. Spent", {
context: "voucher list table header"
})}
</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colStart}>
{i18n.t("Starts", {
context: "voucher list table header"
})}
</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colEnd}>
{i18n.t("Ends", {
context: "voucher list table header"
})}
</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colValue}>
{i18n.t("Value", {
context: "voucher list table header"
})}
</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colUses}>
{i18n.t("Uses", {
context: "voucher list table header"
})}
@@ -129,10 +166,10 @@ const VoucherList = withStyles(styles, {
}}
/>
</TableCell>
- <TableCell>
+ <TableCell className={classes.colName}>
{maybe<React.ReactNode>(() => voucher.name, <Skeleton />)}
</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colMinSpent}>
{voucher && voucher.minAmountSpent ? (
<Money money={voucher.minAmountSpent} />
) : voucher && voucher.minAmountSpent === null ? (
@@ -141,14 +178,14 @@ const VoucherList = withStyles(styles, {
<Skeleton />
)}
</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colStart}>
{voucher && voucher.startDate ? (
<Date date={voucher.startDate} />
) : (
<Skeleton />
)}
</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colEnd}>
{voucher && voucher.endDate ? (
<Date date={voucher.endDate} />
) : voucher && voucher.endDate === null ? (
@@ -158,7 +195,7 @@ const VoucherList = withStyles(styles, {
)}
</TableCell>
<TableCell
- className={classes.textRight}
+ className={classes.colValue}
onClick={voucher ? onRowClick(voucher.id) : undefined}
>
{voucher &&
@@ -179,7 +216,7 @@ const VoucherList = withStyles(styles, {
<Skeleton />
)}
</TableCell>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colUses}>
{voucher && voucher.usageLimit ? (
voucher.usageLimit
) : voucher && voucher.usageLimit === null ? (
diff --git a/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsx b/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsx
index f1a4144be4..08e3898af5 100644
--- a/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsx
@@ -1,5 +1,10 @@
import Checkbox from "@material-ui/core/Checkbox";
-import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";
+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";
@@ -22,14 +27,30 @@ import {
import { ListActions, ListProps } from "../../../types";
import { OrderDraftList_draftOrders_edges_node } from "../../types/OrderDraftList";
-const styles = createStyles({
- link: {
- cursor: "pointer"
- },
- textRight: {
- textAlign: "right"
- }
-});
+const styles = (theme: Theme) =>
+ createStyles({
+ [theme.breakpoints.up("lg")]: {
+ colCustomer: {
+ width: 300
+ },
+ colDate: {
+ width: 300
+ },
+ colNumber: {
+ width: 120
+ },
+ colTotal: {}
+ },
+ colCustomer: {},
+ colDate: {},
+ colNumber: {},
+ colTotal: {
+ textAlign: "right"
+ },
+ link: {
+ cursor: "pointer"
+ }
+ });
interface OrderDraftListProps
extends ListProps,
@@ -64,16 +85,16 @@ export const OrderDraftList = withStyles(styles, { name: "OrderDraftList" })(
<TableHead selected={selected} toolbar={toolbar}>
<TableRow>
<TableCell />
- <TableCell padding="dense">
+ <TableCell padding="dense" className={classes.colNumber}>
{i18n.t("No. of Order", { context: "table header" })}
</TableCell>
- <TableCell padding="dense">
+ <TableCell padding="dense" className={classes.colDate}>
{i18n.t("Date", { context: "table header" })}
</TableCell>
- <TableCell padding="dense">
+ <TableCell padding="dense" className={classes.colCustomer}>
{i18n.t("Customer", { context: "table header" })}
</TableCell>
- <TableCell className={classes.textRight} padding="dense">
+ <TableCell className={classes.colTotal} padding="dense">
{i18n.t("Total", { context: "table header" })}
</TableCell>
</TableRow>
@@ -116,21 +137,21 @@ export const OrderDraftList = withStyles(styles, { name: "OrderDraftList" })(
}}
/>
</TableCell>
- <TableCell padding="dense">
+ <TableCell padding="dense" className={classes.colNumber}>
{maybe(() => order.number) ? (
"#" + order.number
) : (
<Skeleton />
)}
</TableCell>
- <TableCell padding="dense">
+ <TableCell padding="dense" className={classes.colDate}>
{maybe(() => order.created) ? (
<DateTime date={order.created} />
) : (
<Skeleton />
)}
</TableCell>
- <TableCell padding="dense">
+ <TableCell padding="dense" className={classes.colCustomer}>
{maybe(() => order.billingAddress) ? (
<>
{order.billingAddress.firstName}
@@ -143,7 +164,7 @@ export const OrderDraftList = withStyles(styles, { name: "OrderDraftList" })(
<Skeleton />
)}
</TableCell>
- <TableCell className={classes.textRight} padding="dense">
+ <TableCell className={classes.colTotal} padding="dense">
{maybe(() => order.total.gross) ? (
<Money money={order.total.gross} />
) : (
diff --git a/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx b/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx
index ede9bb0941..cda63a223e 100644
--- a/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx
@@ -1,5 +1,10 @@
import Checkbox from "@material-ui/core/Checkbox";
-import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";
+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";
@@ -23,14 +28,36 @@ import {
import { ListActions, ListProps } from "../../../types";
import { OrderList_orders_edges_node } from "../../types/OrderList";
-const styles = createStyles({
- link: {
- cursor: "pointer"
- },
- textRight: {
- textAlign: "right"
- }
-});
+const styles = (theme: Theme) =>
+ createStyles({
+ [theme.breakpoints.up("lg")]: {
+ colCustomer: {
+ width: 220
+ },
+ colDate: {},
+ colFulfillment: {
+ width: 230
+ },
+ colNumber: {
+ width: 120
+ },
+ colPayment: {
+ width: 220
+ },
+ colTotal: {}
+ },
+ colCustomer: {},
+ colDate: {},
+ colFulfillment: {},
+ colNumber: {},
+ colPayment: {},
+ colTotal: {
+ textAlign: "right"
+ },
+ link: {
+ cursor: "pointer"
+ }
+ });
interface OrderListProps
extends ListProps,
@@ -65,22 +92,22 @@ export const OrderList = withStyles(styles, { name: "OrderList" })(
<TableHead selected={selected} toolbar={toolbar}>
<TableRow>
<TableCell />
- <TableCell padding="dense">
+ <TableCell padding="dense" className={classes.colNumber}>
{i18n.t("No. of Order", { context: "table header" })}
</TableCell>
- <TableCell padding="dense">
+ <TableCell padding="dense" className={classes.colDate}>
{i18n.t("Date", { context: "table header" })}
</TableCell>
- <TableCell padding="dense">
+ <TableCell padding="dense" className={classes.colCustomer}>
{i18n.t("Customer", { context: "table header" })}
</TableCell>
- <TableCell padding="dense">
+ <TableCell padding="dense" className={classes.colPayment}>
{i18n.t("Payment", { context: "table header" })}
</TableCell>
- <TableCell padding="dense">
+ <TableCell padding="dense" className={classes.colFulfillment}>
{i18n.t("Fulfillment status", { context: "table header" })}
</TableCell>
- <TableCell className={classes.textRight} padding="dense">
+ <TableCell className={classes.colTotal} padding="dense">
{i18n.t("Total", { context: "table header" })}
</TableCell>
</TableRow>
@@ -123,21 +150,21 @@ export const OrderList = withStyles(styles, { name: "OrderList" })(
}}
/>
</TableCell>
- <TableCell padding="dense">
+ <TableCell padding="dense" className={classes.colNumber}>
{maybe(() => order.number) ? (
"#" + order.number
) : (
<Skeleton />
)}
</TableCell>
- <TableCell padding="dense">
+ <TableCell padding="dense" className={classes.colDate}>
{maybe(() => order.created) ? (
<DateTime date={order.created} />
) : (
<Skeleton />
)}
</TableCell>
- <TableCell padding="dense">
+ <TableCell padding="dense" className={classes.colCustomer}>
{maybe(() => order.billingAddress) ? (
<>
{order.billingAddress.firstName}
@@ -150,7 +177,7 @@ export const OrderList = withStyles(styles, { name: "OrderList" })(
<Skeleton />
)}
</TableCell>
- <TableCell padding="dense">
+ <TableCell padding="dense" className={classes.colPayment}>
{maybe(() => order.paymentStatus.status) !== undefined ? (
order.paymentStatus.status === null ? null : (
<StatusLabel
@@ -162,7 +189,7 @@ export const OrderList = withStyles(styles, { name: "OrderList" })(
<Skeleton />
)}
</TableCell>
- <TableCell padding="dense">
+ <TableCell padding="dense" className={classes.colFulfillment}>
{maybe(() => order.status) ? (
<StatusLabel
status={order.status.status}
@@ -172,7 +199,7 @@ export const OrderList = withStyles(styles, { name: "OrderList" })(
<Skeleton />
)}
</TableCell>
- <TableCell className={classes.textRight} padding="dense">
+ <TableCell className={classes.colTotal} padding="dense">
{maybe(() => order.total.gross) ? (
<Money money={order.total.gross} />
) : (
diff --git a/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx b/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
index f71341e56a..bbd04a5a5b 100644
--- a/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
+++ b/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
@@ -1,6 +1,11 @@
import Card from "@material-ui/core/Card";
import Checkbox from "@material-ui/core/Checkbox";
-import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";
+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";
@@ -21,11 +26,24 @@ export interface PageListProps extends ListProps, ListActions {
pages: PageList_pages_edges_node[];
}
-const styles = createStyles({
- link: {
- cursor: "pointer"
- }
-});
+const styles = (theme: Theme) =>
+ createStyles({
+ [theme.breakpoints.up("lg")]: {
+ colSlug: {
+ width: 250
+ },
+ colTitle: {},
+ colVisibility: {
+ width: 200
+ }
+ },
+ colSlug: {},
+ colTitle: {},
+ colVisibility: {},
+ link: {
+ cursor: "pointer"
+ }
+ });
const PageList = withStyles(styles, { name: "PageList" })(
({
classes,
@@ -45,13 +63,13 @@ const PageList = withStyles(styles, { name: "PageList" })(
<TableHead selected={selected} toolbar={toolbar}>
<TableRow>
<TableCell />
- <TableCell padding="dense">
+ <TableCell className={classes.colTitle} padding="dense">
{i18n.t("Title", { context: "table header" })}
</TableCell>
- <TableCell padding="dense">
+ <TableCell className={classes.colSlug} padding="dense">
{i18n.t("Slug", { context: "table header" })}
</TableCell>
- <TableCell padding="dense">
+ <TableCell className={classes.colVisibility} padding="dense">
{i18n.t("Visibility", { context: "table header" })}
</TableCell>
</TableRow>
@@ -94,13 +112,13 @@ const PageList = withStyles(styles, { name: "PageList" })(
}}
/>
</TableCell>
- <TableCell>
+ <TableCell className={classes.colTitle}>
{maybe<React.ReactNode>(() => page.title, <Skeleton />)}
</TableCell>
- <TableCell>
+ <TableCell className={classes.colSlug}>
{maybe<React.ReactNode>(() => page.slug, <Skeleton />)}
</TableCell>
- <TableCell>
+ <TableCell className={classes.colVisibility}>
{maybe<React.ReactNode>(
() => (
<StatusLabel
diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx
index b441480b84..dd96059c0c 100644
--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx
+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx
@@ -1,6 +1,11 @@
import Card from "@material-ui/core/Card";
import Checkbox from "@material-ui/core/Checkbox";
-import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";
+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";
@@ -17,17 +22,24 @@ import { maybe, renderCollection, translatedTaxRates } from "../../../misc";
import { ListActions, ListProps } from "../../../types";
import { ProductTypeList_productTypes_edges_node } from "../../types/ProductTypeList";
-const styles = createStyles({
- leftText: {
- textAlign: "left"
- },
- link: {
- cursor: "pointer"
- },
- wideCell: {
- width: "60%"
- }
-});
+const styles = (theme: Theme) =>
+ createStyles({
+ [theme.breakpoints.up("lg")]: {
+ colName: {},
+ colTax: {
+ width: 300
+ },
+ colType: {
+ width: 300
+ }
+ },
+ colName: {},
+ colTax: {},
+ colType: {},
+ link: {
+ cursor: "pointer"
+ }
+ });
interface ProductTypeListProps
extends ListProps,
@@ -55,13 +67,13 @@ const ProductTypeList = withStyles(styles, { name: "ProductTypeList" })(
<TableHead selected={selected} toolbar={toolbar}>
<TableRow>
<TableCell />
- <TableCell className={classes.wideCell}>
+ <TableCell className={classes.colName}>
{i18n.t("Type Name", { context: "table header" })}
</TableCell>
- <TableCell className={classes.leftText}>
+ <TableCell className={classes.colType}>
{i18n.t("Type", { context: "table header" })}
</TableCell>
- <TableCell className={classes.leftText}>
+ <TableCell className={classes.colTax}>
{i18n.t("Tax", { context: "table header" })}
</TableCell>
</TableRow>
@@ -105,7 +117,7 @@ const ProductTypeList = withStyles(styles, { name: "ProductTypeList" })(
}}
/>
</TableCell>
- <TableCell>
+ <TableCell className={classes.colName}>
{productType ? (
<>
{productType.name}
@@ -123,7 +135,7 @@ const ProductTypeList = withStyles(styles, { name: "ProductTypeList" })(
<Skeleton />
)}
</TableCell>
- <TableCell className={classes.leftText}>
+ <TableCell className={classes.colType}>
{maybe(() => productType.isShippingRequired) !==
undefined ? (
productType.isShippingRequired ? (
@@ -135,7 +147,7 @@ const ProductTypeList = withStyles(styles, { name: "ProductTypeList" })(
<Skeleton />
)}
</TableCell>
- <TableCell className={classes.leftText}>
+ <TableCell className={classes.colTax}>
{maybe(() => productType.taxRate) ? (
translatedTaxRates()[productType.taxRate]
) : (
diff --git a/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx b/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx
index 4173e2ed76..e80b365dda 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx
@@ -29,6 +29,24 @@ import { ProductVariant_costPrice } from "../../types/ProductVariant";
const styles = (theme: Theme) =>
createStyles({
+ [theme.breakpoints.up("lg")]: {
+ colName: {},
+ colPrice: {
+ width: 200
+ },
+ colSku: {
+ width: 250
+ },
+ colStatus: {
+ width: 200
+ }
+ },
+ colName: {},
+ colPrice: {
+ textAlign: "right"
+ },
+ colSku: {},
+ colStatus: {},
denseTable: {
"& td, & th": {
paddingRight: theme.spacing.unit * 3
@@ -93,11 +111,13 @@ export const ProductVariants = withStyles(styles, { name: "ProductVariants" })(
<TableHead selected={selected} toolbar={toolbar}>
<TableRow>
<TableCell />
- <TableCell className={classes.textLeft}>{i18n.t("Name")}</TableCell>
- <TableCell>{i18n.t("Status")}</TableCell>
- <TableCell>{i18n.t("SKU")}</TableCell>
+ <TableCell className={classes.colName}>{i18n.t("Name")}</TableCell>
+ <TableCell className={classes.colStatus}>
+ {i18n.t("Status")}
+ </TableCell>
+ <TableCell className={classes.colSku}>{i18n.t("SKU")}</TableCell>
<Hidden smDown>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colPrice}>
{i18n.t("Price")}
</TableCell>
</Hidden>
@@ -128,10 +148,10 @@ export const ProductVariants = withStyles(styles, { name: "ProductVariants" })(
}}
/>
</TableCell>
- <TableCell className={classes.textLeft}>
+ <TableCell className={classes.colName}>
{variant ? variant.name || variant.sku : <Skeleton />}
</TableCell>
- <TableCell>
+ <TableCell className={classes.colStatus}>
{variant ? (
<StatusLabel
status={variant.stockQuantity > 0 ? "success" : "error"}
@@ -145,9 +165,11 @@ export const ProductVariants = withStyles(styles, { name: "ProductVariants" })(
<Skeleton />
)}
</TableCell>
- <TableCell>{variant ? variant.sku : <Skeleton />}</TableCell>
+ <TableCell className={classes.colSku}>
+ {variant ? variant.sku : <Skeleton />}
+ </TableCell>
<Hidden smDown>
- <TableCell className={classes.textRight}>
+ <TableCell className={classes.colPrice}>
{variant ? (
variant.priceOverride ? (
<Money money={variant.priceOverride} />
diff --git a/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx b/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx
index d576a5bae2..6614acf873 100644
--- a/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx
+++ b/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx
@@ -34,12 +34,18 @@ export interface ShippingZonesListProps extends ListProps, ListActions {
const styles = (theme: Theme) =>
createStyles({
+ [theme.breakpoints.up("lg")]: {
+ colCountries: {},
+ colName: { width: 200 }
+ },
alignRight: {
"&:last-child": {
paddingRight: theme.spacing.unit
},
width: ICONBUTTON_SIZE + theme.spacing.unit / 2
},
+ colCountries: {},
+ colName: {},
row: {
cursor: "pointer"
}
@@ -76,8 +82,12 @@ const ShippingZonesList = withStyles(styles, { name: "ShippingZonesList" })(
<TableHead selected={selected} toolbar={toolbar}>
<TableRow>
<TableCell />
- <TableCell>{i18n.t("Name", { context: "object" })}</TableCell>
- <TableCell>{i18n.t("Countries", { context: "object" })}</TableCell>
+ <TableCell className={classes.colName}>
+ {i18n.t("Name", { context: "object" })}
+ </TableCell>
+ <TableCell className={classes.colCountries}>
+ {i18n.t("Countries", { context: "object" })}
+ </TableCell>
<TableCell />
</TableRow>
</TableHead>
@@ -121,13 +131,13 @@ const ShippingZonesList = withStyles(styles, { name: "ShippingZonesList" })(
}}
/>
</TableCell>
- <TableCell>
+ <TableCell className={classes.colName}>
{maybe<React.ReactNode>(
() => shippingZone.name,
<Skeleton />
)}
</TableCell>
- <TableCell>
+ <TableCell className={classes.colCountries}>
{maybe<React.ReactNode>(
() => shippingZone.countries.length,
<Skeleton />
diff --git a/saleor/static/dashboard-next/theme.ts b/saleor/static/dashboard-next/theme.ts
index 4e3a1a01f9..4261613d96 100644
--- a/saleor/static/dashboard-next/theme.ts
+++ b/saleor/static/dashboard-next/theme.ts
@@ -145,7 +145,7 @@ export default (colors: IThemeColors): Theme =>
fontWeight: 400
},
paddingCheckbox: {
- width: "1%"
+ width: 72
},
root: {
"&:first-child": {