Skip to content

Commit d4e0faa

Browse files
polmfyaoguz
andauthored
Fix faqs (#200)
Co-authored-by: Yaoyao Guo <168144675+liugetu@users.noreply.github.com>
1 parent 080c340 commit d4e0faa

3 files changed

Lines changed: 61 additions & 70 deletions

File tree

public/faqs.svg

Lines changed: 12 additions & 19 deletions
Loading

public/faqsmobile.svg

Lines changed: 20 additions & 0 deletions
Loading

src/app/components/FAQs.tsx

Lines changed: 29 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import styled, { css } from "styled-components";
1+
import styled from "styled-components";
22
import {
33
applications_faqs,
44
hackupc_faqs,
@@ -39,46 +39,25 @@ const TitleSpacer = styled.div`
3939
`;
4040

4141
const SectionTitleStyled = styled(SectionTitle)`
42-
position: relative;
4342
display: flex;
4443
align-items: center;
4544
justify-content: center;
46-
width: 50%;
4745
margin: 0 auto;
48-
background-color: #5b5340;
49-
padding: ${SpacingS};
50-
height: auto;
46+
47+
padding: ${SpacingM} clamp(4rem, 15vw, 12rem);
48+
background-image: url("/faqs.svg");
49+
background-repeat: no-repeat;
50+
background-position: center;
51+
background-size: contain;
52+
width: 100%;
53+
max-width: 700px;
5154
5255
@media (max-width: ${MobileBreakpoint}) {
53-
width: 95%;
56+
padding: ${SpacingS} clamp(2rem, 20vw, 6rem);
57+
background-image: url("/faqsmobile.svg");
5458
}
5559
`;
5660

57-
const TitleImageWrapper = styled.div`
58-
position: absolute;
59-
left: 50%;
60-
top: 50%;
61-
transform: translate(-50%, -51%);
62-
width: 97%;
63-
height: 83%;
64-
z-index: 1;
65-
pointer-events: none;
66-
`;
67-
68-
const TitleImage = styled(Image)`
69-
position: absolute;
70-
inset: 0;
71-
object-fit: fill;
72-
`;
73-
74-
const TitleText = styled.span`
75-
position: relative;
76-
z-index: 2;
77-
flex: 1;
78-
text-align: center;
79-
white-space: nowrap;
80-
`;
81-
8261
const Split = styled.div`
8362
display: flex;
8463
justify-content: center;
@@ -141,16 +120,15 @@ const SupportImage = styled(Image)<{
141120
142121
${(props) =>
143122
props.side === "left"
144-
? css`
123+
? `
145124
left: 75px;
146125
`
147-
: css`
126+
: `
148127
right: 75px;
149128
`}
150129
`;
151130

152131
const AnswerBox = styled.div<{ isVisible: boolean }>`
153-
overflow: hidden;
154132
max-height: 0;
155133
opacity: 0;
156134
transform-origin: top;
@@ -160,8 +138,8 @@ const AnswerBox = styled.div<{ isVisible: boolean }>`
160138
161139
${(props) =>
162140
props.isVisible &&
163-
css`
164-
max-height: 1000px;
141+
`
142+
max-height: 10000px;
165143
opacity: 1;
166144
padding: ${SpacingXS};
167145
margin-top: ${SpacingM};
@@ -179,7 +157,6 @@ const AnswerInner = styled.div`
179157
`;
180158

181159
const AnswerImageWrapper = styled.div`
182-
position: absolute;
183160
inset: 0;
184161
185162
img {
@@ -265,20 +242,23 @@ const LastBlock = styled.div`
265242
const BlockTitleStyled = styled(BlockTitle)`
266243
color: #5b5340;
267244
background-color: #f0e3d8;
245+
font-weight: bold;
268246
border-radius: 11px;
269247
display: inline-flex;
270248
align-items: center;
271249
justify-content: flex-start;
272250
width: fit-content;
273-
padding: ${SpacingXS};
274-
padding-right: ${SpacingM};
251+
padding: ${SpacingS} ${SpacingM};
252+
padding-right: ${SpacingL};
275253
276254
@media (max-width: ${MobileBreakpoint}) {
277255
border-radius: 0 11px 11px 0;
278256
margin-left: calc(-50vw + 50%);
279257
margin-top: ${SpacingS};
280258
flex-direction: column;
281259
align-self: flex-start;
260+
padding-right: ${SpacingM};
261+
padding-left: ${SpacingL};
282262
283263
&:first-child {
284264
margin-top: 0;
@@ -287,13 +267,19 @@ const BlockTitleStyled = styled(BlockTitle)`
287267
`;
288268

289269
const LastBlockTitle = styled(BlockTitleStyled)`
270+
width: auto;
271+
justify-content: center;
272+
text-align: center;
273+
padding-left: ${SpacingM};
274+
padding-right: ${SpacingM};
275+
border-radius: 11px;
276+
290277
@media (max-width: ${MobileBreakpoint}) {
291278
align-self: center;
292279
justify-content: center;
293280
text-align: center;
294281
margin-left: 0;
295-
border-radius: 11px;
296-
padding: ${SpacingXS};
282+
padding: ${SpacingXS} ${SpacingM};
297283
}
298284
`;
299285

@@ -361,7 +347,6 @@ export default function FAQs() {
361347
side="left"
362348
isVisible={activeFaqId === faq.id}
363349
/>
364-
365350
<SupportImage
366351
src="/suport.svg"
367352
alt="support right"
@@ -370,7 +355,6 @@ export default function FAQs() {
370355
side="right"
371356
isVisible={activeFaqId === faq.id}
372357
/>
373-
374358
<QuestionTitleWrap>
375359
<TorchWrapper onClick={() => toggleFaq(faq.id)}>
376360
{activeFaqId === faq.id && (
@@ -384,7 +368,6 @@ export default function FAQs() {
384368
)}
385369
<TorchIcon src="/torch.svg" alt="torch" width={24} height={24} />
386370
</TorchWrapper>
387-
388371
<QuestionTitle onClick={() => toggleFaq(faq.id)}>
389372
{faq.question}
390373
</QuestionTitle>
@@ -408,12 +391,7 @@ export default function FAQs() {
408391
return (
409392
<Section id="faqs">
410393
<TitleSpacer>
411-
<SectionTitleStyled>
412-
<TitleImageWrapper>
413-
<TitleImage src="/faqs.svg" alt="FAQs icon" fill />
414-
</TitleImageWrapper>
415-
<TitleText className={lora.className}>FAQs</TitleText>
416-
</SectionTitleStyled>
394+
<SectionTitleStyled className={lora.className}>FAQs</SectionTitleStyled>
417395
</TitleSpacer>
418396

419397
<Split>

0 commit comments

Comments
 (0)