-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be5dd8c
commit ae6a902
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."), | ||
}) | ||
); | ||
}, | ||
}); |