From bd9c9ae7e2ae973969569dd434836de9f38b07d4 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Tue, 7 Nov 2023 16:55:58 +0100 Subject: 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) --- .../approved-comment/approved-comment.stories.tsx | 126 +++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 src/components/organisms/comment/approved-comment/approved-comment.stories.tsx (limited to 'src/components/organisms/comment/approved-comment/approved-comment.stories.tsx') 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; + +const Template: ComponentStory = (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', +}; -- cgit v1.2.3