Skip to content

Commit

Permalink
Merge pull request #379 from nwplus/hackcamp2023_dev
Browse files Browse the repository at this point in the history
Hackcamp2023 dev
  • Loading branch information
michelleykim authored Oct 25, 2023
2 parents 33461d3 + 61804d6 commit 48e230d
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 22 deletions.
Binary file added public/hackcamp2023meta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/hc-og.png
Binary file not shown.
15 changes: 5 additions & 10 deletions src/components/FaqBox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ const Container = styled.div`
overflow:hidden;
${p => p.expanded
? `
? `
border-color: #C4B2F0;
`
: `
: `
border-color: #C4B2F0;
`}
Expand Down Expand Up @@ -75,15 +75,10 @@ const Arrow = ({ color }) => (
</svg>
)

const FaqBox = ({ question, answer }) => {
const [isExpanded, setIsExpanded] = useState(false)

const FaqBox = ({ question, answer, isExpanded, onExpand }) => {
return (
<Container
expanded={isExpanded}>
<Top
expanded={isExpanded}
onClick={() => setIsExpanded(!isExpanded)}>
<Container expanded={isExpanded}>
<Top expanded={isExpanded} onClick={onExpand}>
{question}
<TopExpand style={isExpanded ? { transform: 'rotate(0)' } : { transform: 'rotate(180deg)' }}>
<Arrow color={isExpanded ? '#2C2543' : '#2C2543'} />
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function Index ({ title }) {
participants can learn new skills, connect with fellow tech
enthusiasts, and build solutions to tackle challenges together."
/>
<meta property="og:image" content="/hc-og.png" />
<meta property="og:image" content="/hackcamp2023meta.png" />
</Head>

{/* Components Starts */}
Expand Down
41 changes: 31 additions & 10 deletions src/sections/Faq.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const bobbing = keyframes`
50% {
transform: translateY(-20px);
}
`;
`

const Nugget = styled.div`
background: url('assets/background/faq/nugget.png') no-repeat;
Expand Down Expand Up @@ -211,16 +211,31 @@ display:none;
}
`

const FaqCollection = ({ category, faqs }) => (
const FaqCollection = ({ category, faqs, expandedQuestion, setExpandedQuestion }) => (
<CollectionContainer>
<CollectionName>{category}</CollectionName>

{faqs.map(q => <FaqBox key={q.question} question={q.question} answer={q.answer} />)}
{faqs.map(q =>
<FaqBox
key={q.question}
question={q.question}
answer={q.answer}
isExpanded={expandedQuestion === q.question}
onExpand={() => {
if (expandedQuestion === q.question) {
setExpandedQuestion(null)
} else {
setExpandedQuestion(q.question)
}
}}
/>
)}
</CollectionContainer>
)

const Faq = () => {
const [faqData, setFaqData] = useState(null)
const [expandedQuestion, setExpandedQuestion] = useState(null)

// (@htdf processData)
// (@signature (listof FAQ) -> Object)
Expand Down Expand Up @@ -249,7 +264,7 @@ const Faq = () => {
<Nugget></Nugget>
<BearArm />
<DeerArm></DeerArm>
<BgScroll/>
<BgScroll />
<Wrapper id="faq">
<StyledTitle>
FAQ
Expand All @@ -258,24 +273,30 @@ const Faq = () => {
{faqData
? (
<FaqGrid>

<FaqColumn>
{faqData.General &&
<FaqCollection category="General" faqs={faqData.General} />
<FaqCollection
category="General"
faqs={faqData.General}
expandedQuestion={expandedQuestion}
setExpandedQuestion={setExpandedQuestion}
/>
}
</FaqColumn>

<FaqColumn>
{faqData["Teams & Projects"] &&
<FaqCollection category="Projects" faqs={faqData["Teams & Projects"]} />
{faqData['Teams & Projects'] &&
<FaqCollection category="Projects" faqs={faqData['Teams & Projects']} expandedQuestion={expandedQuestion}
setExpandedQuestion={setExpandedQuestion} />
}
{faqData.Logistics &&
<FaqCollection category="Logistics" faqs={faqData.Logistics} />
<FaqCollection category="Logistics" faqs={faqData.Logistics} expandedQuestion={expandedQuestion}
setExpandedQuestion={setExpandedQuestion} />
}
</FaqColumn>

</FaqGrid>
)
)
: 'loading...'}

</Wrapper>
Expand Down
2 changes: 1 addition & 1 deletion src/sections/Learn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const StyledText = styled.div`
z-index:4;
${(p) => p.theme.mediaQueries.mobile} {
flex-direction: column-reverse;
flex-direction: column;
align-items: center;
margin-top: 55vw;
gap: 80vw;
Expand Down

0 comments on commit 48e230d

Please sign in to comment.