Skip to content

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

Add not found page

dominik-zeglene6dc80077b63
diff --git a/saleor/static/dashboard-next/components/NotFoundPage/NotFoundPage.tsx b/saleor/static/dashboard-next/components/NotFoundPage/NotFoundPage.tsx
new file mode 100644
index 0000000000..fd606f7d96
--- /dev/null
+++ b/saleor/static/dashboard-next/components/NotFoundPage/NotFoundPage.tsx
@@ -0,0 +1,85 @@
+import Button from "@material-ui/core/Button";
+import { withStyles } from "@material-ui/core/styles";
+import Typography from "@material-ui/core/Typography";
+import * as React from "react";
+import SVG from "react-inlinesvg";
+
+import * as notFoundImage from "../../../images/not-found-404.svg";
+import i18n from "../../i18n";
+
+interface NotFoundPageProps {
+ onBack: () => void;
+}
+
+const decorate = withStyles(theme => ({
+ button: {
+ marginTop: theme.spacing.unit * 2,
+ padding: 20
+ },
+ container: {
+ [theme.breakpoints.down("sm")]: {
+ gridTemplateColumns: "1fr",
+ padding: theme.spacing.unit * 3,
+ width: "100%"
+ },
+ display: "grid" as "grid",
+ gridTemplateColumns: "1fr 487px",
+ margin: "0 auto",
+ width: 830
+ },
+ header: {
+ fontWeight: 600 as 600
+ },
+ innerContainer: {
+ [theme.breakpoints.down("sm")]: {
+ order: 1,
+ textAlign: "center" as "center"
+ },
+ display: "flex" as "flex",
+ flexDirection: "column" as "column",
+ justifyContent: "center" as "center"
+ },
+ notFoundImage: {
+ "& svg": {
+ width: "100%"
+ }
+ },
+ root: {
+ alignItems: "center" as "center",
+ display: "flex" as "flex",
+ height: "100vh",
+ width: "100vw"
+ }
+}));
+const NotFoundPage = decorate<NotFoundPageProps>(({ classes, onBack }) => (
+ <div className={classes.root}>
+ <div className={classes.container}>
+ <div className={classes.innerContainer}>
+ <div>
+ <Typography className={classes.header} variant="display2">
+ {i18n.t("Ooops!...")}
+ </Typography>
+ <Typography className={classes.header} variant="display1">
+ {i18n.t("Something's missing")}
+ </Typography>
+ <Typography>{i18n.t("Sorry the page not found")}</Typography>
+ </div>
+ <div>
+ <Button
+ className={classes.button}
+ color="secondary"
+ variant="contained"
+ onClick={onBack}
+ >
+ {i18n.t("Go back to dashboard", { context: "button" })}
+ </Button>
+ </div>
+ </div>
+ <div>
+ <SVG className={classes.notFoundImage} src={notFoundImage} />
+ </div>
+ </div>
+ </div>
+));
+NotFoundPage.displayName = "NotFoundPage";
+export default NotFoundPage;
diff --git a/saleor/static/dashboard-next/components/NotFoundPage/index.ts b/saleor/static/dashboard-next/components/NotFoundPage/index.ts
new file mode 100644
index 0000000000..df151ffeb5
--- /dev/null
+++ b/saleor/static/dashboard-next/components/NotFoundPage/index.ts
@@ -0,0 +1,2 @@
+export { default } from "./NotFoundPage";
+export * from "./NotFoundPage";
diff --git a/saleor/static/dashboard-next/storybook/config.js b/saleor/static/dashboard-next/storybook/config.js
index 60bea66615..1e3df1e0af 100644
--- a/saleor/static/dashboard-next/storybook/config.js
+++ b/saleor/static/dashboard-next/storybook/config.js
@@ -13,6 +13,7 @@ function loadStories() {
require("./stories/components/Money");
require("./stories/components/MultiAutocompleteSelectField");
require("./stories/components/MultiSelectField");
+ require("./stories/components/NotFoundPage");
require("./stories/components/PageHeader");
require("./stories/components/Percent");
require("./stories/components/PhoneField");
diff --git a/saleor/static/dashboard-next/storybook/stories/components/NotFoundPage.tsx b/saleor/static/dashboard-next/storybook/stories/components/NotFoundPage.tsx
new file mode 100644
index 0000000000..7015b84b55
--- /dev/null
+++ b/saleor/static/dashboard-next/storybook/stories/components/NotFoundPage.tsx
@@ -0,0 +1,9 @@
+import { storiesOf } from "@storybook/react";
+import * as React from "react";
+
+import NotFoundPage from "../../../components/NotFoundPage";
+import Decorator from "../../Decorator";
+
+storiesOf("Views / Not found error page", module)
+ .addDecorator(Decorator)
+ .add("default", () => <NotFoundPage onBack={() => undefined} />);
diff --git a/saleor/static/images/not-found-404.svg b/saleor/static/images/not-found-404.svg
new file mode 100644
index 0000000000..3d240f77fc
--- /dev/null
+++ b/saleor/static/images/not-found-404.svg
@@ -0,0 +1,3 @@
+<svg width="487" height="257" viewBox="0 0 487 257" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M0 186.283L27.7022 215.527H63.4453L69.3415 185.298L0 186.283ZM91.8596 79.5938L76.8475 152.211H46.4659L91.8596 79.5938ZM144.402 0L111.518 152.211H125.101L117.237 187.444L105.799 185.298L95.0764 228.224H60.0483L88.6427 256.842H122.956L134.394 213.916H144.402L152.994 179.795L142.06 168.288L171.747 27.0091L144.402 0ZM315.253 186.283L342.956 215.527H378.699L384.595 185.298L315.253 186.283ZM407.113 79.5938L392.101 152.211H361.719L407.113 79.5938ZM459.655 0L426.772 152.211H440.354L432.491 187.444L421.053 185.298L410.33 228.224H375.302L403.896 256.842H438.209L449.647 213.916H459.655L468.248 179.795L457.313 168.288L487 27.0091L459.655 0ZM264.767 47.1731C260.209 27.0979 231.658 31.5679 223.751 51.7347L197.928 168.932C194.173 195.226 213.54 198.788 228.309 189.099L252.972 75.8821L261.281 67.2968L264.767 47.1731ZM284.068 9.61264C297.41 23.4606 301.314 38.1871 298.277 55.2689L272.184 179.795C267.538 202.649 221.964 248.614 176.751 218.031L202.843 247.006C239.167 273.343 289.493 244.041 301.136 200.86L326.514 86.7481C334.02 53.569 318.828 36.2183 284.068 9.61264Z" fill="#C4C4C4"/>
+</svg>