-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from LaurierHawkHacks/feature/96/faq
feature/96/faq
- Loading branch information
Showing
6 changed files
with
82 additions
and
3 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// components/Accordion.tsx | ||
import React, { useState } from 'react'; | ||
|
||
interface AccordionProps { | ||
items: { question: string; answer: string }[]; | ||
} | ||
|
||
const Accordion: React.FC<AccordionProps> = ({ items }) => { | ||
const [activeIndex, setActiveIndex] = useState<number | null>(null); | ||
|
||
const toggleAccordion = (index: number) => { | ||
setActiveIndex((prevIndex) => (prevIndex === index ? null : index)); | ||
}; | ||
|
||
return ( | ||
<div className="py-20 flex flex-wrap"> | ||
{items.map((item, index) => ( | ||
<div key={index} className="px-3 w-full md:w-1/2 mb-5"> | ||
<div | ||
className={`cursor-pointer flex justify-between items-center p-2 bg-white border-black rounded-xl border ${ | ||
activeIndex === index ? 'rounded-b-none' : '' | ||
}`} | ||
onClick={() => toggleAccordion(index)} | ||
> | ||
<h6 className="text-black">{item.question}</h6> | ||
<span>{activeIndex === index ? '^' : '⌄'}</span> | ||
</div> | ||
{activeIndex === index && ( | ||
<div className="p-2 bg-deepMarine border-black rounded-xl rounded-t-none border"> | ||
<h6 className="text-white">{item.answer}</h6> | ||
</div> | ||
)} | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Accordion; | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import Accordion from '../Accordion'; | ||
|
||
const FAQSection: React.FC = () => { | ||
const faqData = [ | ||
{ question: 'So, what exactly is a hackathon?', answer: 'Our product is...' }, | ||
{ question: 'Do I need a team?', answer: 'Our product is...' }, | ||
{ question: 'When and where is HawkHacks happening?', answer: 'Our product is...' }, | ||
{ question: 'Are there any prizes?', answer: 'Our product is...' }, | ||
{ question: 'How much does it cost?', answer: 'Our product is...' }, | ||
{ question: 'Who can attend? Do I need to be a skilled leet programmer?', answer: 'Our product is...' }, | ||
{ question: 'This is a cool FAQ but I still have questions!', answer: 'Our product is...' }, | ||
// Add more FAQ items as needed | ||
]; | ||
|
||
|
||
return ( | ||
<section className="bg-faq-image bg-brightUbe bg-cover"> | ||
<div className="h-full flex flex-col justify-center items-center"> | ||
<h2 className="mt-60 text-center text-white font-bold drop-shadow-md"> | ||
FAQ | ||
</h2> | ||
<div className="mx-auto max-w-[66.5rem] mb-96"> | ||
<Accordion items={faqData} /> | ||
</div> | ||
</div> | ||
</section> | ||
); | ||
}; | ||
|
||
|
||
export { FAQSection}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters