diff --git a/apps/dimentorin/src/app/(public)/(home)/_components/faq-section.tsx b/apps/dimentorin/src/app/(public)/(home)/_components/faq-section.tsx new file mode 100644 index 0000000..6f00e9a --- /dev/null +++ b/apps/dimentorin/src/app/(public)/(home)/_components/faq-section.tsx @@ -0,0 +1,94 @@ +import { Button } from '@imphnen-frontend-service/ui/atoms' +import { Accordion, AccordionOptions } from '@imphnen-frontend-service/ui/molecules' +import { FC, useRef } from 'react' +import { motion, useInView, Variants } from 'framer-motion' +import { cn, For } from '@imphnen-frontend-service/utils' + +const FAQ_DATA: AccordionOptions[] = [ + { title: 'Apakah saya bisa memilih mentor sendiri?', description: 'Tentu! Kamu bisa memilih mentor yang sesuai dengan kebutuhan dan level skill kamu.' }, + { title: 'Apakah mentoring ini cocok untuk pemula?', description: 'Yap! Baik newbie maupun seasoned dev bisa menemukan mentor yang pas untuk mempercepat progres belajarnya.' }, + { title: 'Apakah ini seperti sekolah coding biasa?', description: 'Nope! Ini lebih dari sekadar kursus-kursus AI guide dan mentor berpengalaman, kamu mendapatkan pengalaman belajar yang jauh lebih personal dan efektif.' }, +] + +export const FAQSection: FC = () => { + const ref = useRef(null) + const isInView = useInView(ref, { once: true, amount: 0.2 }) + + const containerVariants: Variants = { + hidden: { opacity: 0 }, + visible: { + opacity: 1, + transition: { + staggerChildren: 0.1, + delayChildren: 0.2, + }, + }, + } + + const childVariants: Variants = { + hidden: { opacity: 0, y: 20 }, + visible: { + opacity: 1, + y: 0, + transition: { + duration: 0.4, + ease: [0.25, 0.46, 0.45, 0.94], + }, + }, + } + + return ( + + + + Frequently Ask Question + + + + + + Console log for new developers + + + + + {(props) => ( + + + + )} + + + + + ) +} diff --git a/apps/dimentorin/src/app/(public)/(home)/page.tsx b/apps/dimentorin/src/app/(public)/(home)/page.tsx index aeb763e..fc3d8f1 100644 --- a/apps/dimentorin/src/app/(public)/(home)/page.tsx +++ b/apps/dimentorin/src/app/(public)/(home)/page.tsx @@ -2,6 +2,7 @@ import { FC, ReactElement } from 'react'; import { HeroSection } from './_components/hero-section'; import { WhatWeOfferSection } from './_components/what-we-offer-section'; import { TestimonialSection } from './_components/testimonial-section'; +import { FAQSection } from './_components/faq-section'; export const Components: FC = (): ReactElement => { return ( @@ -9,6 +10,7 @@ export const Components: FC = (): ReactElement => { + > ); }; diff --git a/libs/ui/src/molecules/accordion/accordion.tsx b/libs/ui/src/molecules/accordion/accordion.tsx new file mode 100644 index 0000000..822513c --- /dev/null +++ b/libs/ui/src/molecules/accordion/accordion.tsx @@ -0,0 +1,53 @@ +import { cn, Show } from "@imphnen-frontend-service/utils" +import { DetailedHTMLProps, FC, HTMLAttributes, useState } from "react" +import { AnimatePresence, motion, Variants } from "framer-motion" +import { MinusOutlined, PlusOutlined } from "@ant-design/icons" + +export type AccordionOptions = { + title: string + description: string +} + +export type AccordionProps = DetailedHTMLProps< + HTMLAttributes, + HTMLDivElement +> & AccordionOptions & { + titleClassName?: string + contentClassName?: string +} + +export const Accordion: FC = ({ title, description, className, titleClassName, contentClassName, ...rest }) => { + const [expand, setExpand] = useState(false) + + const variants: Variants = { + expand: { opacity: 1, y: 0, marginBottom: 16, height: 'auto' }, + collapse: { opacity: 0, y: -10, marginBottom: 0, height: 0 }, + } + + return ( + + setExpand(prev => !prev)}> + {title} + + }> + + + + + + {expand && ( + + {description} + + )} + + + ) +} diff --git a/libs/ui/src/molecules/accordion/index.ts b/libs/ui/src/molecules/accordion/index.ts new file mode 100644 index 0000000..ce956fe --- /dev/null +++ b/libs/ui/src/molecules/accordion/index.ts @@ -0,0 +1 @@ +export * from './accordion'; diff --git a/libs/ui/src/molecules/index.ts b/libs/ui/src/molecules/index.ts index 1bc94a6..ad99b97 100644 --- a/libs/ui/src/molecules/index.ts +++ b/libs/ui/src/molecules/index.ts @@ -4,3 +4,4 @@ export * from './input-field'; export * from './pagination'; export * from './modal/modal'; export * from './stepper'; +export * from './accordion'; \ No newline at end of file