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

Fix UI dropdown action bug on Frequently asked Questions #156

Merged
merged 3 commits into from
Jun 4, 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
2 changes: 1 addition & 1 deletion website/src/components/Faq.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Faq: React.FC = () => {
Frequently asked Questions
</h2>
<div className="flex flex-col gap-y-[24px] items-center w-full">
<FaqBar question="How do i Join Joyboy?" answer="" />
<FaqBar question="How do i Join Joyboy?" answer="Joyboy" />
<FaqBar question="What kind of contents can i post?" answer="" />
<FaqBar
question="How can i contribute to the Joyboy project?"
Expand Down
26 changes: 22 additions & 4 deletions website/src/components/FaqBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,29 @@ type Props = { answer: string; question: string };

const FaqBar: React.FC<Props> = ({ question, answer }) => {
const [isOpen, setIsOpen] = useState(false);
const handleClick = () => {
if (isOpen === true) {
setIsOpen(false);
} else {
setIsOpen(true);
}
};
return (
<div className="py-4 tab:py-[32px] px-3 tab:px-[25px] flex justify-between items-center text-white border-[1px] border-[#C9C9C9] bg-black rounded-xl max-w-[871px] desktop:w-[871px] w-full">
<h2 className="desktop:text-[20px] text-xs leading-[28px]">{question}</h2>
<img src={downCheveron} alt="" />
</div>
<>
<button
onClick={handleClick}
className=" py-4 tab:py-[32px] px-3 tab:px-[25px] border-[1px] border-[#C9C9C9] text-white bg-black rounded-xl max-w-[871px] desktop:w-[871px] w-full"
>
<div className=" flex justify-between items-center">
<h2 className="desktop:text-[20px] text-xs leading-[28px]">
{question}
</h2>
<img src={downCheveron} alt="" />
</div>

<div>{isOpen ? <p className=" w-full text-start mt-6">{answer}</p> : ""}</div>
</button>
</>
);
};

Expand Down
Loading