Skip to content

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

Fix homepage header

Lukasz Szewczykd7495bc3acbc
diff --git a/saleor/static/dashboard-next/home/components/Dashbaord/Dashbaord.tsx b/saleor/static/dashboard-next/home/components/Dashbaord/Dashbaord.tsx
index 9dd0cc0ef3..ef94de5dfb 100644
--- a/saleor/static/dashboard-next/home/components/Dashbaord/Dashbaord.tsx
+++ b/saleor/static/dashboard-next/home/components/Dashbaord/Dashbaord.tsx
@@ -1,11 +1,10 @@
import { withStyles } from "@material-ui/core/styles";
-import Typography from "@material-ui/core/Typography";
import * as React from "react";
+
import CardSpacer from "../../../components/CardSpacer";
import Container from "../../../components/Container";
-import PageHeader from "../../../components/PageHeader";
-import i18n from "../../../i18n";
import HomeActivityCard from "../HomeActivityCard";
+import HomeHeader from "../HomeHeader";
import HomeOrdersCard from "../HomeOrdersCard";
import HomeProductListCard from "../HomeProductListCard";
import HomeSalesCard from "../HomeSalesCard";
@@ -31,7 +30,7 @@ export interface DashboardProps {
sales: MoneyType;
};
onRowClick: () => undefined;
- ownerName: string;
+ userName: string;
topProducts: Array<{
id: string;
name: string;
@@ -63,18 +62,11 @@ const decorate = withStyles(theme => ({
}
}));
const Dashboard = decorate<DashboardProps>(
- ({ ownerName, classes, daily, topProducts, onRowClick, activities }) => {
+ ({ userName, classes, daily, topProducts, onRowClick, activities }) => {
return (
<Container width="md">
- <PageHeader
- className={classes.displayBlock}
- title={i18n.t("Hello there, {{userName}}", { userName: ownerName })}
- >
- <Typography component="span">
- {i18n.t("Here are some information we gathered about your store")}
- </Typography>
- </PageHeader>
-
+ <HomeHeader userName={userName} />
+ <CardSpacer />
<div className={classes.root}>
<div>
<div className={classes.flexbox}>
diff --git a/saleor/static/dashboard-next/home/components/HomeHeader/HomeHeader.tsx b/saleor/static/dashboard-next/home/components/HomeHeader/HomeHeader.tsx
new file mode 100644
index 0000000000..8b056f1643
--- /dev/null
+++ b/saleor/static/dashboard-next/home/components/HomeHeader/HomeHeader.tsx
@@ -0,0 +1,39 @@
+import { withStyles } from "@material-ui/core/styles";
+import Typography from "@material-ui/core/Typography";
+import * as React from "react";
+import Skeleton from "../../../components/Skeleton";
+import i18n from "../../../i18n";
+
+interface HomeOrdersCardProps {
+ userName: string;
+}
+
+const decorate = withStyles({
+ pageHeader: {
+ fontWeight: 600 as 600
+ }
+});
+
+const HomeOrdersCard = decorate<HomeOrdersCardProps>(
+ ({ classes, userName }) => {
+ return (
+ <div>
+ <Typography className={classes.pageHeader} variant={"headline"}>
+ {userName ? (
+ i18n.t("Hello there, {{userName}}", { userName })
+ ) : (
+ <Skeleton style={{ width: "10em" }} />
+ )}
+ </Typography>
+ <Typography variant={"subheading"}>
+ {userName ? (
+ i18n.t("Here are some information we gathered about your store")
+ ) : (
+ <Skeleton style={{ width: "10em" }} />
+ )}
+ </Typography>
+ </div>
+ );
+ }
+);
+export default HomeOrdersCard;
diff --git a/saleor/static/dashboard-next/home/components/HomeHeader/index.ts b/saleor/static/dashboard-next/home/components/HomeHeader/index.ts
new file mode 100644
index 0000000000..be3bc03ae8
--- /dev/null
+++ b/saleor/static/dashboard-next/home/components/HomeHeader/index.ts
@@ -0,0 +1,2 @@
+export { default } from "./HomeHeader";
+export * from "./HomeHeader";
diff --git a/saleor/static/dashboard-next/home/fixtures.ts b/saleor/static/dashboard-next/home/fixtures.ts
index 7c73467556..a57f030b01 100644
--- a/saleor/static/dashboard-next/home/fixtures.ts
+++ b/saleor/static/dashboard-next/home/fixtures.ts
@@ -45,13 +45,13 @@ export const shop = (placeholderImage: string) => ({
currency: "PLN"
}
},
+
notifications: {
orders: 12,
payments: 10,
problems: 69,
productsOut: 2
},
- ownerName: "Zbyszko z Bogdańca",
topProducts: [
{
id: "1",
@@ -97,5 +97,6 @@ export const shop = (placeholderImage: string) => ({
thumbnailUrl: placeholderImage,
variant: "Hardcover"
}
- ]
+ ],
+ userName: "Zbyszko z Bogdańca"
});
diff --git a/saleor/static/dashboard-next/storybook/stories/home/dashboard.tsx b/saleor/static/dashboard-next/storybook/stories/home/dashboard.tsx
index 549adf9250..4c94a15116 100644
--- a/saleor/static/dashboard-next/storybook/stories/home/dashboard.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/home/dashboard.tsx
@@ -11,8 +11,8 @@ const dashboardProps: DashboardProps = {
activities: shop.activities,
daily: shop.daily,
onRowClick: () => undefined,
- ownerName: shop.ownerName,
- topProducts: shop.topProducts
+ topProducts: shop.topProducts,
+ userName: shop.userName
};
storiesOf("Views / Home / Dashboard", module)
@@ -24,6 +24,7 @@ storiesOf("Views / Home / Dashboard", module)
topProducts={undefined}
daily={undefined}
activities={undefined}
+ userName={undefined}
/>
))
.add("no data", () => (