2019-06-19 14:40:52 +00:00
|
|
|
import { storiesOf } from "@storybook/react";
|
2019-08-09 10:26:22 +00:00
|
|
|
import React from "react";
|
2019-06-19 14:40:52 +00:00
|
|
|
|
|
|
|
import PageDetailsPage, {
|
|
|
|
FormData,
|
|
|
|
PageDetailsPageProps
|
|
|
|
} from "../../../pages/components/PageDetailsPage";
|
|
|
|
import { page } from "../../../pages/fixtures";
|
|
|
|
import Decorator from "../../Decorator";
|
|
|
|
import { formError } from "../../misc";
|
|
|
|
|
|
|
|
const props: PageDetailsPageProps = {
|
|
|
|
disabled: false,
|
|
|
|
errors: [],
|
|
|
|
onBack: () => undefined,
|
|
|
|
onRemove: () => undefined,
|
|
|
|
onSubmit: () => undefined,
|
|
|
|
page,
|
|
|
|
saveButtonBarState: "default"
|
|
|
|
};
|
|
|
|
|
|
|
|
storiesOf("Views / Pages / Page details", module)
|
|
|
|
.addDecorator(Decorator)
|
|
|
|
.add("default", () => <PageDetailsPage {...props} />)
|
|
|
|
.add("loading", () => (
|
|
|
|
<PageDetailsPage {...props} disabled={true} page={undefined} />
|
|
|
|
))
|
|
|
|
.add("form errors", () => (
|
|
|
|
<PageDetailsPage
|
|
|
|
{...props}
|
|
|
|
errors={([
|
|
|
|
"title",
|
|
|
|
"slug",
|
|
|
|
"content",
|
|
|
|
"publicationDate",
|
|
|
|
"isPublished",
|
|
|
|
"seoDescription",
|
|
|
|
"seoTitle"
|
|
|
|
] as Array<keyof FormData>).map(formError)}
|
|
|
|
/>
|
|
|
|
));
|