From f88bfad73b0f88eb9a26e990702c8e739d08469e Mon Sep 17 00:00:00 2001 From: HasithDeAlwis Date: Tue, 19 Nov 2024 20:37:35 -0500 Subject: [PATCH] feat(libs/website/feature/faq): create faq section --- libs/website/feature/faq/index.ts | 2 + .../feature/faq/ui/faq-item/faq-item.tsx | 25 ++++++++ .../faq-presenter/faq.presenter.stories.tsx | 60 +++++++++++++++++++ .../faq/ui/faq-presenter/faq.presenter.tsx | 21 +++++++ libs/website/feature/faq/ui/faq.section.tsx | 15 +++++ 5 files changed, 123 insertions(+) create mode 100644 libs/website/feature/faq/index.ts create mode 100644 libs/website/feature/faq/ui/faq-item/faq-item.tsx create mode 100644 libs/website/feature/faq/ui/faq-presenter/faq.presenter.stories.tsx create mode 100644 libs/website/feature/faq/ui/faq-presenter/faq.presenter.tsx create mode 100644 libs/website/feature/faq/ui/faq.section.tsx diff --git a/libs/website/feature/faq/index.ts b/libs/website/feature/faq/index.ts new file mode 100644 index 00000000..0defb3de --- /dev/null +++ b/libs/website/feature/faq/index.ts @@ -0,0 +1,2 @@ +export { FAQSection } from './ui/faq.section' +export { FAQPresenter } from './ui/faq-presenter/faq.presenter' diff --git a/libs/website/feature/faq/ui/faq-item/faq-item.tsx b/libs/website/feature/faq/ui/faq-item/faq-item.tsx new file mode 100644 index 00000000..2702c662 --- /dev/null +++ b/libs/website/feature/faq/ui/faq-item/faq-item.tsx @@ -0,0 +1,25 @@ +import { AccordionContent, AccordionItem, AccordionTrigger } from '@cuhacking/shared/ui/src/cuHacking/components/accordion' +import { TerminalText } from '@cuhacking/shared/ui/src/cuHacking/components/terminal-text' +import React from 'react' + +interface FAQItemProps { + question: string + answer: string +} + +export function FAQItem({ question, answer }: FAQItemProps) { + return ( + + +

+ faq( + {question} + ) +

+
+ + {answer} + +
+ ) +} diff --git a/libs/website/feature/faq/ui/faq-presenter/faq.presenter.stories.tsx b/libs/website/feature/faq/ui/faq-presenter/faq.presenter.stories.tsx new file mode 100644 index 00000000..ab7657bf --- /dev/null +++ b/libs/website/feature/faq/ui/faq-presenter/faq.presenter.stories.tsx @@ -0,0 +1,60 @@ +import type { Meta, StoryObj } from '@storybook/react' +import { FAQPresenter } from './faq.presenter' + +const meta = { + title: 'Website/FAQ Presenter', + component: FAQPresenter, + tags: ['autodocs'], + args: { + questions: [ + { + question: 'What is an FAQ?', + answer: 'FAQ stands for Frequently Asked Questions.', + }, + { + question: 'How do I use Storybook?', + answer: 'Storybook is a development environment for UI components.', + }, + ], + }, + argTypes: { + questions: { + control: { + type: 'object', + }, + }, + }, +} satisfies Meta + +export default meta +type Story = StoryObj + +export const CustomFAQs: Story = { + args: { + questions: [ + { + question: 'What is the purpose of an FAQ?', + answer: 'The purpose of an FAQ is to provide quick answers to common questions.', + }, + { + question: 'How do I contribute to this project?', + answer: 'You can contribute by opening pull requests and submitting issues.', + }, + ], + }, +} + +export const LongFAQs: Story = { + args: { + questions: [ + { + question: 'What are the benefits of using this FAQ system in a project?', + answer: 'This FAQ system allows users to find answers to their most frequently asked questions without needing to contact support or search through documentation.', + }, + { + question: 'How do I use the accordion component in my React project?', + answer: 'You can use the accordion component by importing it from our component library, passing the necessary props such as "type" and "collapsible", and wrapping your FAQ items inside it.', + }, + ], + }, +} diff --git a/libs/website/feature/faq/ui/faq-presenter/faq.presenter.tsx b/libs/website/feature/faq/ui/faq-presenter/faq.presenter.tsx new file mode 100644 index 00000000..9f551000 --- /dev/null +++ b/libs/website/feature/faq/ui/faq-presenter/faq.presenter.tsx @@ -0,0 +1,21 @@ +import { Accordion } from '@cuhacking/shared/ui/src/cuHacking/components/accordion' +import { GlassmorphicCard } from '@cuhacking/shared/ui/src/cuHacking/components/glassmorphic-card' +import React from 'react' +import { FAQItem } from '../faq-item/faq-item' + +interface FAQPresenterProps { + questions: { question: string, answer: string }[] +} + +export function FAQPresenter({ questions }: FAQPresenterProps) { + return ( + +

FAQ

+ + {questions.map(({ question, answer }) => ( + + ))} + +
+ ) +} diff --git a/libs/website/feature/faq/ui/faq.section.tsx b/libs/website/feature/faq/ui/faq.section.tsx new file mode 100644 index 00000000..70165b17 --- /dev/null +++ b/libs/website/feature/faq/ui/faq.section.tsx @@ -0,0 +1,15 @@ +import React from 'react' +import { FAQ_CONSTANTS } from '../constants/faq.constants' +import { FAQPresenter } from './faq-presenter/faq.presenter' + +export function FAQSection() { + return ( +
+
+
+ +
+
+
+ ) +}