Skip to content

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

Add size property for TableCellAvatar and custom MuiAvatar styling

Lukasz Szewczyke8cf8aa2b738
diff --git a/saleor/static/dashboard-next/components/TableCellAvatar/TableCellAvatar.tsx b/saleor/static/dashboard-next/components/TableCellAvatar/TableCellAvatar.tsx
index cf5ab264df..aade04c39a 100644
--- a/saleor/static/dashboard-next/components/TableCellAvatar/TableCellAvatar.tsx
+++ b/saleor/static/dashboard-next/components/TableCellAvatar/TableCellAvatar.tsx
@@ -10,16 +10,10 @@ import NoPhoto from "../../icons/NoPhoto";
interface TableCellAvatarProps {
className?: string;
thumbnail?: string;
+ avatarSize?: string;
}
const decorate = withStyles(theme => ({
- avatar: {
- background: "none",
- border: "1px solid #eaeaea",
- borderRadius: 2,
- color: "#bdbdbd",
- padding: theme.spacing.unit / 2
- },
root: {
paddingLeft: theme.spacing.unit * 3,
paddingRight: theme.spacing.unit * 3,
@@ -27,18 +21,18 @@ const decorate = withStyles(theme => ({
}
}));
const TableCellAvatar = decorate<TableCellAvatarProps>(
- ({ classes, className, thumbnail }) => (
+ ({ classes, className, thumbnail, avatarSize }) => (
<TableCell className={classNames(classes.root, className)}>
{thumbnail === undefined ? (
- <Avatar className={classes.avatar}>
+ <Avatar className={classNames(avatarSize)}>
<Cached />
</Avatar>
) : thumbnail === null ? (
- <Avatar className={classes.avatar}>
+ <Avatar className={classNames(avatarSize)}>
<NoPhoto />
</Avatar>
) : (
- <Avatar className={classes.avatar} src={thumbnail} />
+ <Avatar className={classNames(avatarSize)} src={thumbnail} />
)}
</TableCell>
)
diff --git a/saleor/static/dashboard-next/home/components/HomeProductListCard/HomeProductList.tsx b/saleor/static/dashboard-next/home/components/HomeProductListCard/HomeProductList.tsx
index e02b021194..3f94223a7f 100644
--- a/saleor/static/dashboard-next/home/components/HomeProductListCard/HomeProductList.tsx
+++ b/saleor/static/dashboard-next/home/components/HomeProductListCard/HomeProductList.tsx
@@ -31,6 +31,10 @@ interface HomeProductListProps {
}
const decorate = withStyles(theme => ({
+ avatarSize: {
+ height: "64px",
+ width: "64px"
+ },
tableRowPointer: {
cursor: "pointer" as "pointer"
},
@@ -58,6 +62,7 @@ export const HomeProductList = decorate<HomeProductListProps>(
<TableCellAvatar
className={classes.tableRowSize}
thumbnail={product && product.thumbnailUrl}
+ avatarSize={classes.avatarSize}
/>
{product ? (
<TableCell>
diff --git a/saleor/static/dashboard-next/theme.ts b/saleor/static/dashboard-next/theme.ts
index 5c110abd93..ba1b76eef8 100644
--- a/saleor/static/dashboard-next/theme.ts
+++ b/saleor/static/dashboard-next/theme.ts
@@ -1,4 +1,5 @@
import { createMuiTheme } from "@material-ui/core/styles";
+import spacing from "@material-ui/core/styles/spacing";
const createShadow = (pv, pb, ps, uv, ub, us, av, ab, as) =>
[
@@ -16,6 +17,17 @@ export const ICONBUTTON_SIZE = 48;
export default createMuiTheme({
overrides: {
+ MuiAvatar: {
+ colorDefault: {
+ backgroundColor: "none",
+ color: "#bdbdbd"
+ },
+ root: {
+ border: "1px solid #eaeaea",
+ borderRadius: 2,
+ padding: spacing.unit / 2
+ }
+ },
MuiButton: {
label: {
fontWeight: 600