Skip to content

Commit 0b1a4a4

Browse files
author
brianshattuck
committed
Done faq section for mobile version
1 parent ac85aaa commit 0b1a4a4

File tree

2 files changed

+109
-52
lines changed

2 files changed

+109
-52
lines changed

src/pages/LaunchpadPage/FAQ.tsx

Lines changed: 67 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import StartIcon from 'assets/images/launchpad/faq/start-icon.svg';
55
import FeesIcon from 'assets/images/launchpad/faq/fees-eligibility-icon.svg';
66
import SecurityIcon from 'assets/images/launchpad/faq/security-icon.svg';
77
import TroubleIcon from 'assets/images/launchpad/faq/troubleshooting-icon.svg';
8+
import { ChevronDown, ChevronUp } from 'react-feather';
89

910
interface FAQItem {
1011
question: string;
@@ -24,34 +25,35 @@ const FAQItem: React.FC<FAQItem & { isOpen: boolean; toggle: () => void }> = ({
2425
isOpen,
2526
toggle,
2627
}) => (
27-
<div>
28-
<button
29-
className='w-full text-left pl-3 pr-2 py-3 flex justify-between items-center border-t border-[#282D3D]'
30-
onClick={toggle}
31-
>
28+
<Box>
29+
<button className='faq-item-button' onClick={toggle}>
3230
<span className='text-base lg:text-lg leading-6 font-semibold'>
3331
{question}
3432
</span>
33+
<ChevronDown
34+
size='20'
35+
className={`down-icon ${isOpen && 'rotate-180'}`}
36+
/>
3537
{/* <ChevronDownIcon
3638
className={clsx({
3739
['min-w-5 h-5 p-[2px] lg:p-0 transition-transform duration-300']: true,
3840
['rotate-180']: isOpen,
3941
})}
4042
/> */}
4143
</button>
42-
<div
43-
className={`overflow-hidden transition-all duration-300 ease-in-out ${
44-
isOpen ? 'opacity-100' : 'max-h-0 opacity-0'
44+
<Box
45+
className={`cover-faq-item ${
46+
isOpen ? 'faq-item-open' : 'faq-item-close'
4547
}`}
4648
>
47-
<div className='p-4'>
49+
<Box style={{ padding: '16px' }}>
4850
<p
49-
className='text-gray-300'
51+
style={{ color: '#D1D5DB' }}
5052
dangerouslySetInnerHTML={{ __html: answer }}
5153
></p>
52-
</div>
53-
</div>
54-
</div>
54+
</Box>
55+
</Box>
56+
</Box>
5557
);
5658

5759
const FAQ: React.FC = () => {
@@ -187,48 +189,62 @@ You should see a prompt from BlockPass saying, “If you have previously created
187189
<Typography className='title2'>Frequently Asked Questions</Typography>
188190
</Box>
189191
<Box className='cover-faq'>
190-
<Box className='cover-faq-list'>
191-
{faqList.map((faq) => (
192-
<Box
193-
className={`faq ${faq.id === tabActive && 'faq-selected'}`}
194-
key={faq.id}
195-
onClick={() => handleSelectTab(faq.id)}
196-
>
192+
<Box className='flex-40'>
193+
<Box className='cover-faq-list'>
194+
{faqList.map((faq) => (
197195
<Box
198-
className={`cover-img ${faq.id === tabActive &&
199-
'cover-img-selected'}`}
196+
className={`faq ${faq.id === tabActive && 'faq-selected'}`}
197+
key={faq.id}
198+
onClick={() => handleSelectTab(faq.id)}
200199
>
201-
<img src={faq.logo} alt={faq.id} />
202-
</Box>
203-
<Box>
204-
<Typography className='faq-name'>{faq.name}</Typography>
205-
</Box>
206-
{tabActive === faq.id && (
207-
<svg
208-
width='79'
209-
height='14'
210-
viewBox='0 0 79 14'
211-
fill='none'
212-
strokeWidth='1.5'
213-
stroke='currentColor'
214-
className='faq-arrow'
215-
xmlns='http://www.w3.org/2000/svg'
200+
<Box
201+
className={`cover-img ${faq.id === tabActive &&
202+
'cover-img-selected'}`}
216203
>
217-
<g>
218-
<path
219-
d='M1 7H78M78 7L72 1M78 7L72 13'
220-
stroke='#4d5d7994'
221-
strokeWidth='1.5'
222-
strokeLinecap='round'
223-
strokeLinejoin='round'
224-
/>
225-
</g>
226-
</svg>
227-
)}
228-
</Box>
229-
))}
204+
<img src={faq.logo} alt={faq.id} />
205+
</Box>
206+
<Box>
207+
<Typography className='faq-name'>{faq.name}</Typography>
208+
</Box>
209+
{tabActive === faq.id && (
210+
<svg
211+
width='79'
212+
height='14'
213+
viewBox='0 0 79 14'
214+
fill='none'
215+
strokeWidth='1.5'
216+
stroke='currentColor'
217+
className='faq-arrow'
218+
xmlns='http://www.w3.org/2000/svg'
219+
>
220+
<g>
221+
<path
222+
d='M1 7H78M78 7L72 1M78 7L72 13'
223+
stroke='#4d5d7994'
224+
strokeWidth='1.5'
225+
strokeLinecap='round'
226+
strokeLinejoin='round'
227+
/>
228+
</g>
229+
</svg>
230+
)}
231+
</Box>
232+
))}
233+
</Box>
234+
</Box>
235+
<Box className='cover-faq-items'>
236+
{faqList
237+
.find((faq) => faq.id === tabActive)
238+
?.faq?.map((item, index) => (
239+
<FAQItem
240+
key={index}
241+
question={item.question}
242+
answer={item.answer}
243+
isOpen={openItems.includes(index)}
244+
toggle={() => toggleItem(index)}
245+
/>
246+
))}
230247
</Box>
231-
<Box className='cover-faq-items'></Box>
232248
</Box>
233249
</Box>
234250
);

src/pages/styles/launchpad.scss

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,14 @@
238238
margin-top: 1.5rem;
239239
}
240240

241+
.flex-40 {
242+
flex: 40%;
243+
}
244+
241245
.cover-faq-list {
242246
display: grid;
243247
grid-template-columns: repeat(1, minmax(0, 1fr));
244248
gap: 0.25rem;
245-
flex: 40%;
246249
}
247250

248251
.faq {
@@ -294,6 +297,44 @@
294297
.cover-faq-items {
295298
flex: 60%;
296299
}
300+
301+
.faq-item-button {
302+
width: 100%;
303+
text-align: left;
304+
padding: 0.75rem 0.5rem 0.75rem 0.75rem;
305+
border-top: 1px solid #282D3D;
306+
display: flex;
307+
align-items: center;
308+
justify-content: space-between;
309+
cursor: pointer;
310+
span {
311+
font-size: 1.125rem;
312+
line-height: 1.75rem;
313+
font-weight: 600;
314+
}
315+
}
316+
317+
.cover-faq-item {
318+
overflow: hidden;
319+
transition: all 300ms ease-in-out;
320+
}
321+
322+
.faq-item-open {
323+
opacity: 100;
324+
}
325+
326+
.faq-item-close{
327+
max-height: 0;
328+
opacity: 0;
329+
}
330+
331+
.down-icon {
332+
transition: transform 0.3s ease-in-out;
333+
}
334+
335+
.rotate-180 {
336+
transform: rotate(180deg);
337+
}
297338
}
298339

299340
.ctaSection {

0 commit comments

Comments
 (0)