Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tong/362 faq #381

Merged
merged 6 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Black.otf
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Black.woff
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Black.woff2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Bold.otf
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Bold.woff
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Bold.woff2
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Italic.otf
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Italic.woff
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Italic.woff2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Light.otf
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Light.woff
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Light.woff2
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Regular.otf
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Regular.woff
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Regular.woff2
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Screen.eot
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Screen.otf
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Screen.woff
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Screen.woff2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Thin.otf
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Thin.woff
Binary file not shown.
Binary file added public/fonts/Px-Grotesk/Px-Grotesk-Thin.woff2
Binary file not shown.
8 changes: 6 additions & 2 deletions src/app/components/FAQ/FAQ.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Heading } from "@babylonlabs-io/bbn-core-ui";

import { getNetworkConfig } from "@/config/network.config";

import { questions } from "./data/questions";
Expand All @@ -12,8 +14,10 @@ export const FAQ: React.FC<FAQProps> = () => {

return (
<div className="container mx-auto flex flex-col gap-2 p-6">
<h3 className="mb-4 font-bold">FAQ</h3>
<div className="flex flex-col gap-4">
<Heading as="h3" variant="h4" className="mb-8">
FAQ’s
</Heading>
<div className="flex flex-col gap-4 bg-warning-contrast border border-primary-light/20 rounded divide-y p-6">
{questions(coinName, networkName, confirmationDepth).map((question) => (
<Section
key={question.title}
Expand Down
57 changes: 30 additions & 27 deletions src/app/components/FAQ/Section.tsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
import { AnimatePresence, motion } from "framer-motion";
import { useState } from "react";
import { FaMinus, FaPlus } from "react-icons/fa";
import {
Accordion,
AccordionDetails,
AccordionSummary,
Heading,
Text,
} from "@babylonlabs-io/bbn-core-ui";
import { ReactNode } from "react";
import { AiOutlineMinus, AiOutlinePlus } from "react-icons/ai";

interface SectionProps {
title: string;
content: string;
content: ReactNode;
}

export const Section: React.FC<SectionProps> = ({ title, content }) => {
const [isOpen, setIsOpen] = useState(false);

return (
<div
className="card cursor-pointer border bg-base-300 p-4 dark:border-0"
onClick={() => setIsOpen(!isOpen)}
>
<div className="flex items-center justify-between">
<h4 className="font-bold">{title}</h4>
<button className="btn btn-square btn-sm border border-neutral-content bg-transparent">
{isOpen ? <FaMinus /> : <FaPlus />}
</button>
</div>
<AnimatePresence>
{isOpen && (
<motion.p
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
className="mt-4"
dangerouslySetInnerHTML={{ __html: content }}
/>
)}
</AnimatePresence>
<div className="border-primary-light/20 pt-6 first:pt-0 pb-2 first:pb-0">
<Accordion className="text-primary-dark">
<AccordionSummary
className="p-2 text-xl flex justify-between"
renderIcon={(expanded) =>
expanded ? (
<AiOutlineMinus size={24} />
) : (
<AiOutlinePlus size={24} />
)
}
>
<Heading variant="h6">
<span className="align-middle">{title}</span>
</Heading>
</AccordionSummary>
<AccordionDetails className="p-2" unmountOnExit>
<Text>{content}</Text>
</AccordionDetails>
</Accordion>
</div>
);
};
111 changes: 0 additions & 111 deletions src/app/components/FAQ/data/questions.ts

This file was deleted.

Loading