blob: 12bacdd59e0e5304a5a42f9f2473433f4ed0fd82 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
export type StorySectionName = string;
export type StoryName = string;
export type StoryComponent = () => JSX.Element;
export interface IStories {
name: string;
component: StoryComponent;
}
export interface ISections {
name: StorySectionName;
stories: IStories[];
}
export interface IStoryStore {
sections: ISections[];
}
export const storyStore: IStoryStore = {
sections: [],
};
export const storiesOf = (name: StorySectionName) => {
const length = storyStore.sections.push({
name,
stories: [],
});
const actions = {
add: (name: StoryName, component: StoryComponent) => {
storyStore.sections[length - 1].stories.push({
name,
component,
});
return actions;
},
};
return actions;
};
|