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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
import { ComponentMeta, ComponentStory } from '@storybook/react';
import { CommentsList } from './comments-list';
import { comments } from './comments-list.fixture';
const saveComment = async () => {
/** Do nothing. */
};
/**
* CommentsList - Storybook Meta
*/
export default {
title: 'Organisms/Layout/CommentsList',
component: CommentsList,
args: {
saveComment,
},
argTypes: {
comments: {
control: {
type: null,
},
description: 'An array of comments.',
type: {
name: 'object',
required: true,
value: {},
},
},
depth: {
control: {
type: 'number',
min: 0,
max: 4,
},
description: 'The maximum depth. Use `0` to not display nested comments.',
type: {
name: 'number',
required: true,
},
},
Notice: {
control: {
type: null,
},
description: 'A component to display a success or error message.',
table: {
category: 'Options',
},
type: {
name: 'function',
required: false,
},
},
saveComment: {
control: {
type: null,
},
description: 'A callback function to save the comment form data.',
table: {
category: 'Events',
},
type: {
name: 'function',
required: true,
},
},
},
} as ComponentMeta<typeof CommentsList>;
const Template: ComponentStory<typeof CommentsList> = (args) => (
<CommentsList {...args} />
);
/**
* Layout Stories - Without child comments
*/
export const WithoutChildComments = Template.bind({});
WithoutChildComments.args = {
comments,
depth: 0,
};
/**
* Layout Stories - With child comments
*/
export const WithChildComments = Template.bind({});
WithChildComments.args = {
comments,
depth: 1,
};
|