Skip to content

Commit

Permalink
Add remaining stories
Browse files Browse the repository at this point in the history
  • Loading branch information
josephspurrier committed Jul 8, 2020
1 parent be5dd8c commit ae6a902
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/app/ui/src/component/note.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import m from "mithril"; // eslint-disable-line no-unused-vars
import { withKnobs, select } from "@storybook/addon-knobs";
import { withA11y } from "@storybook/addon-a11y";
import Note from "./note";
import Flash from "@/component/flash";
import MockRequest from "@/module/mockrequest";
import "~/style/main.scss";

export default {
title: "Component/Note",
component: Note,
decorators: [withKnobs, withA11y],
};

export const note = () => ({
oninit: () => {
let s = select(
"Operation",
{
Success: "opt1",
Fail: "opt2",
},
"opt1"
);
switch (s) {
case "opt1":
MockRequest.ok({});
break;
case "opt2":
MockRequest.badRequest("There was an error.");
break;
default:
MockRequest.badRequest("There is a problem with the storybook.");
}
},
view: () => (
<app>
<ul>
<Note />
</ul>
<Flash />
</app>
),
});
25 changes: 25 additions & 0 deletions src/app/ui/src/layout/main.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import m from "mithril"; // eslint-disable-line no-unused-vars
import { withKnobs, text } from "@storybook/addon-knobs";
import { withA11y } from "@storybook/addon-a11y";
import LayoutMain from "./main";
import SimplePage from "@/component/simple-page";
import "~/style/main.scss";

export default {
title: "Component/Layout Main",
component: LayoutMain,
decorators: [withKnobs, withA11y],
};

export const simplePage = () => ({
view: () => {
return m(
LayoutMain,
m(SimplePage, {
title: text("Title", "This is the Title"),
description: text("Description", "This is a subtitle or description."),
content: text("Content", "This is the content."),
})
);
},
});

0 comments on commit ae6a902

Please sign in to comment.