-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FAQs] Structure on FAQs section (#12)
* ignore idea folder * structure for FAQs is created * added all the faqs of about hackupc section * created interfaces * added interfaces in faqs and added icon * add travel questions * added all the questions --------- Co-authored-by: Carlota Catot Bragós <[email protected]>
- Loading branch information
Showing
8 changed files
with
461 additions
and
5 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -34,7 +34,3 @@ yarn-error.log* | |
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
# IDE | ||
.idea/ | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,163 @@ | ||
import styled from "styled-components"; | ||
import { | ||
applications_faqs, | ||
hackupc_faqs, | ||
teams_faqs, | ||
travel_faqs, | ||
} from "@/app/data/faqs_data"; | ||
import parse from "html-react-parser"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
import React, { useState } from "react"; | ||
import { faMinus, faPlus } from "@fortawesome/free-solid-svg-icons"; | ||
import { | ||
MobileBreakpoint, | ||
Primary100, | ||
Secondary500, | ||
SpacingL, | ||
SpacingM, | ||
SpacingS, | ||
SpacingXS, | ||
} from "@/app/genericComponents/tokens"; | ||
import { Section } from "@/app/genericComponents/General"; | ||
import { BlockTitle, Body, SectionTitle } from "@/app/genericComponents/Fonts"; | ||
|
||
const Split = styled.div` | ||
display: flex; | ||
justify-content: center; | ||
gap: ${SpacingL}; | ||
@media (max-width: ${MobileBreakpoint}) { | ||
flex-direction: column; | ||
} | ||
`; | ||
|
||
const ColumnsQuestions = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: ${SpacingL}; | ||
width: 45%; | ||
@media (max-width: ${MobileBreakpoint}) { | ||
width: 100%; | ||
} | ||
`; | ||
|
||
const QuestionsBlock = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: ${SpacingS}; | ||
`; | ||
|
||
const Question = styled.div` | ||
display: flex; | ||
justify-content: flex-start; | ||
gap: ${SpacingS}; | ||
`; | ||
|
||
const QuestionTitle = styled(Body)` | ||
margin-bottom: ${SpacingXS}; | ||
font-weight: 700; | ||
`; | ||
|
||
const LastBlock = styled.div` | ||
text-align: center; | ||
margin-top: ${SpacingM}; | ||
`; | ||
|
||
export default function FAQs() { | ||
return <div>This is the FAQs :)</div>; | ||
const [activeFaqId, setActiveFaqId] = useState<null | number>(null); | ||
|
||
const toggleFaq = (id: number) => { | ||
// If the clicked FAQ is already active, close it, otherwise open the clicked FAQ | ||
setActiveFaqId(activeFaqId === id ? null : id); | ||
}; | ||
|
||
return ( | ||
<Section> | ||
<SectionTitle>FAQs</SectionTitle> | ||
<Split> | ||
<ColumnsQuestions> | ||
<QuestionsBlock> | ||
<BlockTitle color={Secondary500}>About HackUPC</BlockTitle> | ||
{hackupc_faqs.map((faq) => ( | ||
<Question key={faq.id} onClick={() => toggleFaq(faq.id)}> | ||
<FontAwesomeIcon | ||
icon={activeFaqId === faq.id ? faMinus : faPlus} | ||
style={{ marginTop: 4 }} | ||
color={activeFaqId === faq.id ? Secondary500 : Primary100} | ||
/> | ||
<div> | ||
<QuestionTitle>{faq.question}</QuestionTitle> | ||
{activeFaqId === faq.id && <Body>{parse(faq.answer)}</Body>} | ||
</div> | ||
</Question> | ||
))} | ||
</QuestionsBlock> | ||
<QuestionsBlock> | ||
<BlockTitle color={Secondary500}>Travel Reimbursement</BlockTitle> | ||
{travel_faqs.map((faq) => ( | ||
<Question key={faq.id} onClick={() => toggleFaq(faq.id)}> | ||
<FontAwesomeIcon | ||
icon={activeFaqId === faq.id ? faMinus : faPlus} | ||
style={{ marginTop: 4 }} | ||
color={activeFaqId === faq.id ? Secondary500 : Primary100} | ||
/> | ||
<div> | ||
<QuestionTitle>{faq.question}</QuestionTitle> | ||
{activeFaqId === faq.id && <Body>{parse(faq.answer)}</Body>} | ||
</div> | ||
</Question> | ||
))} | ||
</QuestionsBlock> | ||
</ColumnsQuestions> | ||
<ColumnsQuestions> | ||
<QuestionsBlock> | ||
<BlockTitle color={Secondary500}>Applications</BlockTitle> | ||
{applications_faqs.map((faq) => ( | ||
<Question key={faq.id} onClick={() => toggleFaq(faq.id)}> | ||
<FontAwesomeIcon | ||
icon={activeFaqId === faq.id ? faMinus : faPlus} | ||
style={{ marginTop: 4 }} | ||
color={activeFaqId === faq.id ? Secondary500 : Primary100} | ||
/> | ||
<div> | ||
<QuestionTitle>{faq.question}</QuestionTitle> | ||
{activeFaqId === faq.id && <Body>{parse(faq.answer)}</Body>} | ||
</div> | ||
</Question> | ||
))} | ||
</QuestionsBlock> | ||
<QuestionsBlock> | ||
<BlockTitle color={Secondary500}>Teams</BlockTitle> | ||
{teams_faqs.map((faq) => ( | ||
<Question key={faq.id} onClick={() => toggleFaq(faq.id)}> | ||
<FontAwesomeIcon | ||
icon={activeFaqId === faq.id ? faMinus : faPlus} | ||
style={{ marginTop: 4 }} | ||
color={activeFaqId === faq.id ? Secondary500 : Primary100} | ||
/> | ||
<div> | ||
<QuestionTitle>{faq.question}</QuestionTitle> | ||
{activeFaqId === faq.id && <Body>{parse(faq.answer)}</Body>} | ||
</div> | ||
</Question> | ||
))} | ||
</QuestionsBlock> | ||
</ColumnsQuestions> | ||
</Split> | ||
<LastBlock> | ||
<BlockTitle color={Secondary500}> | ||
What if I have another question? | ||
</BlockTitle> | ||
<Body style={{ paddingBottom: SpacingS }}> | ||
DM or tag us on X @hackupc or, if you want to contact us via email, | ||
drop us a line at [email protected]. | ||
</Body> | ||
<Body> | ||
If your issue is related to Travel Reimbursment, write us at | ||
[email protected] | ||
</Body> | ||
</LastBlock> | ||
</Section> | ||
); | ||
} |
Oops, something went wrong.