aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/comment/pending-comment
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/organisms/comment/pending-comment')
-rw-r--r--src/components/organisms/comment/pending-comment/index.ts1
-rw-r--r--src/components/organisms/comment/pending-comment/pending-comment.stories.tsx21
-rw-r--r--src/components/organisms/comment/pending-comment/pending-comment.test.tsx13
-rw-r--r--src/components/organisms/comment/pending-comment/pending-comment.tsx36
4 files changed, 71 insertions, 0 deletions
diff --git a/src/components/organisms/comment/pending-comment/index.ts b/src/components/organisms/comment/pending-comment/index.ts
new file mode 100644
index 0000000..9fc189f
--- /dev/null
+++ b/src/components/organisms/comment/pending-comment/index.ts
@@ -0,0 +1 @@
+export * from './pending-comment';
diff --git a/src/components/organisms/comment/pending-comment/pending-comment.stories.tsx b/src/components/organisms/comment/pending-comment/pending-comment.stories.tsx
new file mode 100644
index 0000000..1b6e1d9
--- /dev/null
+++ b/src/components/organisms/comment/pending-comment/pending-comment.stories.tsx
@@ -0,0 +1,21 @@
+import type { ComponentMeta, ComponentStory } from '@storybook/react';
+import { PendingComment } from './pending-comment';
+
+/**
+ * PendingComment - Storybook Meta
+ */
+export default {
+ title: 'Organisms/Comment/PendingComment',
+ component: PendingComment,
+ argTypes: {},
+} as ComponentMeta<typeof PendingComment>;
+
+const Template: ComponentStory<typeof PendingComment> = (args) => (
+ <PendingComment {...args} />
+);
+
+/**
+ * PendingComment Stories - Default
+ */
+export const Default = Template.bind({});
+Default.args = {};
diff --git a/src/components/organisms/comment/pending-comment/pending-comment.test.tsx b/src/components/organisms/comment/pending-comment/pending-comment.test.tsx
new file mode 100644
index 0000000..87914c3
--- /dev/null
+++ b/src/components/organisms/comment/pending-comment/pending-comment.test.tsx
@@ -0,0 +1,13 @@
+import { describe, expect, it } from '@jest/globals';
+import { render, screen as rtlScreen } from '../../../../../tests/utils';
+import { PendingComment } from './pending-comment';
+
+describe('PendingComment', () => {
+ it('renders a text to inform user', () => {
+ render(<PendingComment />);
+
+ expect(
+ rtlScreen.getByText('This comment is awaiting moderation…')
+ ).toBeInTheDocument();
+ });
+});
diff --git a/src/components/organisms/comment/pending-comment/pending-comment.tsx b/src/components/organisms/comment/pending-comment/pending-comment.tsx
new file mode 100644
index 0000000..0d37ac2
--- /dev/null
+++ b/src/components/organisms/comment/pending-comment/pending-comment.tsx
@@ -0,0 +1,36 @@
+import { type ForwardRefRenderFunction, forwardRef } from 'react';
+import { useIntl } from 'react-intl';
+import { Card, CardBody, type CardProps } from '../../../molecules';
+
+export type PendingCommentProps = Omit<
+ CardProps<undefined>,
+ | 'children'
+ | 'content'
+ | 'cover'
+ | 'id'
+ | 'isCentered'
+ | 'linkTo'
+ | 'meta'
+ | 'variant'
+>;
+
+const PendingCommentWithRef: ForwardRefRenderFunction<
+ HTMLDivElement,
+ PendingCommentProps
+> = (props, ref) => {
+ const intl = useIntl();
+
+ return (
+ <Card {...props} ref={ref} variant={2}>
+ <CardBody>
+ {intl.formatMessage({
+ defaultMessage: 'This comment is awaiting moderation…',
+ description: 'PendingComment: awaiting moderation text',
+ id: '1d/xvG',
+ })}
+ </CardBody>
+ </Card>
+ );
+};
+
+export const PendingComment = forwardRef(PendingCommentWithRef);