Skip to content

Commit

Permalink
Revamp the faq section (#585)
Browse files Browse the repository at this point in the history
  • Loading branch information
gauravsingh1281 authored Nov 5, 2024
2 parents df7dc9f + eb906f8 commit b3f1755
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 53 deletions.
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

125 changes: 75 additions & 50 deletions src/components/faq/FAQ.css
Original file line number Diff line number Diff line change
@@ -1,51 +1,76 @@
.faq-container {
width: 80%;
margin: 2rem auto;
background-color: aquamarine;
padding: 2rem;
border-radius: 10px;
}

.faq-title {
text-align: center;
font-size: 2rem;
margin-bottom: 1.5rem;
color: #333;
}

.faq-list {
display: flex;
flex-direction: column;
gap: 1rem;
}

.faq-item {
background-color: white;
border-radius: 8px;
padding: 1rem;
cursor: pointer;
transition: all 0.3s ease;
}

.faq-item:hover {
background-color: #f2f2f2;
}

.faq-question {
font-size: 1.2rem;
font-weight: bold;
color: #555;
}

.faq-answer {
margin-top: 0.5rem;
padding-left: 1rem;
font-size: 1rem;
color: #666;
}

.active .faq-answer {
display: block;
}


width: 80%;
margin: 2rem auto;
padding: 2rem;
background: linear-gradient(135deg, #9be7ff, #b0ffd1);
border-radius: 15px;
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.2);
}

.faq-title {
text-align: center;
font-size: 2.5rem;
margin-bottom: 2rem;
color: #333;
font-weight: bold;
text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
}

.faq-list {
display: flex;
flex-direction: column;
gap: 1rem;
}

.faq-item {
background-color: #ffffff;
border-radius: 8px;
padding: 1rem;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.1);
overflow: hidden;
}

.faq-item:hover {
background-color: #f9f9f9;
transform: scale(1.02);
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.15);
}

.faq-question {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 1.3rem;
font-weight: bold;
color: #444;
}

.faq-icon {
font-size: 1.5rem;
color: #00aaff;
transition: transform 0.3s ease;
}

.faq-item.active .faq-icon {
transform: rotate(180deg);
color: #ff6347;
}

.faq-answer {
max-height: 0;
transition: max-height 0.5s ease, padding 0.5s ease;
padding-top: 0;
color: #666;
}

.faq-item.active .faq-answer {
padding-top: 1rem;
max-height: 500px;
}

.faq-answer p {
font-size: 1rem;
line-height: 1.6;
}
19 changes: 16 additions & 3 deletions src/components/faq/FAQ.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,24 @@ const FAQ = () => {
<h2 className="faq-title">Frequently Asked Questions</h2>
<div className="faq-list">
{faqData.map((faq, index) => (
<div key={index} className={`faq-item ${activeIndex === index ? 'active' : ''}`}>
<div className="faq-question" onClick={() => toggleFAQ(index)}>
<div
key={index}
className={`faq-item ${activeIndex === index ? 'active' : ''}`}
onClick={() => toggleFAQ(index)}
>
<div className="faq-question">
{faq.question}
<span className="faq-icon">{activeIndex === index ? '-' : '+'}</span>
</div>
<div
className="faq-answer"
style={{
maxHeight: activeIndex === index ? '1000px' : '0',
overflow: 'hidden',
}}
>
<p>{faq.answer}</p>
</div>
{activeIndex === index && <div className="faq-answer">{faq.answer}</div>}
</div>
))}
</div>
Expand Down

0 comments on commit b3f1755

Please sign in to comment.