2020-11-05 13:56:29 +00:00
|
|
|
import { OutputData } from "@editorjs/editorjs";
|
|
|
|
import RichTextEditor from "@saleor/components/RichTextEditor";
|
|
|
|
import CardDecorator from "@saleor/storybook/CardDecorator";
|
|
|
|
import Decorator from "@saleor/storybook/Decorator";
|
|
|
|
import { storiesOf } from "@storybook/react";
|
|
|
|
import React from "react";
|
|
|
|
|
|
|
|
import * as fixtures from "./fixtures.json";
|
|
|
|
import { RichTextEditorProps } from "./RichTextEditor";
|
2022-03-16 10:09:12 +00:00
|
|
|
import RichTextEditorContent from "./RichTextEditorContent";
|
2020-11-05 13:56:29 +00:00
|
|
|
|
2022-05-26 08:06:46 +00:00
|
|
|
export const defaultValue: OutputData = fixtures.richTextEditor;
|
2020-11-05 13:56:29 +00:00
|
|
|
|
|
|
|
const props: RichTextEditorProps = {
|
2022-05-26 08:06:46 +00:00
|
|
|
defaultValue,
|
2020-11-05 13:56:29 +00:00
|
|
|
disabled: false,
|
|
|
|
error: false,
|
|
|
|
helperText: "Lorem ipsum dolor sit amet, consectetur adipiscing elit",
|
|
|
|
label: "Content",
|
|
|
|
name: "content",
|
2022-06-21 09:36:55 +00:00
|
|
|
editorRef: null,
|
2020-11-05 13:56:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
storiesOf("Generics / Rich text editor", module)
|
|
|
|
.addDecorator(CardDecorator)
|
|
|
|
.addDecorator(Decorator)
|
|
|
|
.add("default", () => <RichTextEditor {...props} />)
|
|
|
|
.add("disabled", () => <RichTextEditor {...props} disabled={true} />)
|
2022-03-16 10:09:12 +00:00
|
|
|
.add("error", () => <RichTextEditor {...props} error={true} />)
|
2022-05-26 08:06:46 +00:00
|
|
|
.add("static", () => (
|
|
|
|
<RichTextEditorContent {...props} value={defaultValue} />
|
|
|
|
));
|