aboutsummaryrefslogtreecommitdiffstats
path: root/uidev/src/stores/stories.ts
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-01-09 11:05:32 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-01-09 11:05:32 +0100
commit2c514e58eabd71af280b727514dccb7c8db4e6cf (patch)
treeb9677f450fe300c6ff16d1ea1e2af7ea35a7bc02 /uidev/src/stores/stories.ts
parentMake packages work in electron, node and web (diff)
downloadferdium-app-2c514e58eabd71af280b727514dccb7c8db4e6cf.tar.gz
ferdium-app-2c514e58eabd71af280b727514dccb7c8db4e6cf.tar.zst
ferdium-app-2c514e58eabd71af280b727514dccb7c8db4e6cf.zip
Finalize packages & replace storybook with homegrown `uidev`
Diffstat (limited to 'uidev/src/stores/stories.ts')
-rw-r--r--uidev/src/stores/stories.ts43
1 files changed, 43 insertions, 0 deletions
diff --git a/uidev/src/stores/stories.ts b/uidev/src/stores/stories.ts
new file mode 100644
index 000000000..064bf275f
--- /dev/null
+++ b/uidev/src/stores/stories.ts
@@ -0,0 +1,43 @@
1import { store } from './index';
2
3export type StorySectionName = string;
4export type StoryName = string;
5export type StoryComponent = Function;
6
7export interface IStories {
8 name: string;
9 component: StoryComponent;
10}
11
12export interface ISections {
13 name: StorySectionName;
14 stories: IStories[];
15}
16
17export interface IStoryStore {
18 sections: ISections[];
19}
20
21export const storyStore: IStoryStore = {
22 sections: [],
23};
24
25export const storiesOf = (name: StorySectionName) => {
26 const length = storyStore.sections.push({
27 name,
28 stories: [],
29 });
30
31 const actions = {
32 add: (name: StoryName, component: StoryComponent) => {
33 storyStore.sections[length - 1].stories.push({
34 name,
35 component,
36 });
37
38 return actions;
39 },
40 };
41
42 return actions;
43};