aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/comment/approved-comment/approved-comment.stories.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-11-07 16:55:58 +0100
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:15:27 +0100
commitbd9c9ae7e2ae973969569dd434836de9f38b07d4 (patch)
tree84905097c4f2c2db36794c20910e3893189a65e1 /src/components/organisms/comment/approved-comment/approved-comment.stories.tsx
parentc9c1c90b30e243563bb4f731da15b3fe657556d2 (diff)
refactor(components): split Comment component into 3 components
* add ApprovedComment, PendingComment and ReplyCommentForm components * let consumer handle reply form visibility * move structured data into article page (each article already has the comments data and already handle json ltd schema so I prefered to move the schema in the final consumer instead of adding a script element foreach comment)
Diffstat (limited to 'src/components/organisms/comment/approved-comment/approved-comment.stories.tsx')
-rw-r--r--src/components/organisms/comment/approved-comment/approved-comment.stories.tsx126
1 files changed, 126 insertions, 0 deletions
diff --git a/src/components/organisms/comment/approved-comment/approved-comment.stories.tsx b/src/components/organisms/comment/approved-comment/approved-comment.stories.tsx
new file mode 100644
index 0000000..36afa6b
--- /dev/null
+++ b/src/components/organisms/comment/approved-comment/approved-comment.stories.tsx
@@ -0,0 +1,126 @@
+import type { ComponentMeta, ComponentStory } from '@storybook/react';
+import { ApprovedComment } from './approved-comment';
+
+/**
+ * ApprovedComment - Storybook Meta
+ */
+export default {
+ title: 'Organisms/Comment/ApprovedComment',
+ component: ApprovedComment,
+ argTypes: {
+ author: {
+ description: 'The author data.',
+ type: {
+ name: 'object',
+ required: true,
+ value: {},
+ },
+ },
+ content: {
+ control: {
+ type: 'text',
+ },
+ description: 'The comment body.',
+ type: {
+ name: 'string',
+ required: true,
+ },
+ },
+ id: {
+ control: {
+ type: 'string',
+ },
+ description: 'The comment id.',
+ type: {
+ name: 'string',
+ required: true,
+ },
+ },
+ publicationDate: {
+ control: {
+ type: 'text',
+ },
+ description: 'The publication date.',
+ type: {
+ name: 'string',
+ required: true,
+ },
+ },
+ replyBtn: {
+ control: {
+ type: null,
+ },
+ description: 'Add a reply button.',
+ type: {
+ name: 'function',
+ required: false,
+ },
+ },
+ },
+} as ComponentMeta<typeof ApprovedComment>;
+
+const Template: ComponentStory<typeof ApprovedComment> = (args) => (
+ <ApprovedComment {...args} />
+);
+
+/**
+ * ApprovedComment Stories - Default
+ */
+export const Default = Template.bind({});
+Default.args = {
+ author: {
+ name: 'Kameron.Conn',
+ },
+ content:
+ 'Quia est eos deserunt qui perferendis est pariatur eaque. Deserunt omnis quis consectetur ea quam a cupiditate. Velit laboriosam rem nihil numquam quia.',
+ id: 1,
+ publicationDate: '2023-11-06',
+};
+
+/**
+ * ApprovedComment Stories - WithAvatar
+ */
+export const WithAvatar = Template.bind({});
+WithAvatar.args = {
+ author: {
+ avatar: {
+ alt: 'Kameron.Conn avatar',
+ src: 'https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/82.jpg',
+ },
+ name: 'Kameron.Conn',
+ },
+ content:
+ 'Quia est eos deserunt qui perferendis est pariatur eaque. Deserunt omnis quis consectetur ea quam a cupiditate. Velit laboriosam rem nihil numquam quia.',
+ id: 2,
+ publicationDate: '2023-11-06',
+};
+
+/**
+ * ApprovedComment Stories - WithWebsite
+ */
+export const WithWebsite = Template.bind({});
+WithWebsite.args = {
+ author: {
+ name: 'Kameron.Conn',
+ website: 'https://www.armandphilippot.com/',
+ },
+ content:
+ 'Quia est eos deserunt qui perferendis est pariatur eaque. Deserunt omnis quis consectetur ea quam a cupiditate. Velit laboriosam rem nihil numquam quia.',
+ id: 3,
+ publicationDate: '2023-11-06',
+};
+
+/**
+ * ApprovedComment Stories - WithReplyBtn
+ */
+export const WithReplyBtn = Template.bind({});
+WithReplyBtn.args = {
+ author: {
+ name: 'Kameron.Conn',
+ },
+ content:
+ 'Quia est eos deserunt qui perferendis est pariatur eaque. Deserunt omnis quis consectetur ea quam a cupiditate. Velit laboriosam rem nihil numquam quia.',
+ id: 4,
+ publicationDate: '2023-11-06',
+ replyBtn: 'Reply',
+};