Skip to content

Commit b82efca

Browse files
committed
feat: mobile accordion 구현
1 parent 6bb3fc6 commit b82efca

File tree

1 file changed

+62
-68
lines changed

1 file changed

+62
-68
lines changed

packages/common/src/components/mdx_components/mobile_accordion.tsx

Lines changed: 62 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import PyCon2025HostLogoBig from "../../assets/pyconkr2025_hostlogo_big.png";
88
import PyCon2025HostLogoSmall from "../../assets/pyconkr2025_hostlogo_small.png";
99

1010
const MarqueeAccordion: React.FC = () => {
11-
const [marqueeKey, setMarqueeKey] = React.useState<number>(0);
12-
11+
const marqueeWidth = window.innerWidth * 0.9;
12+
const marqueeGradientWidth = window.innerWidth * 0.1;
1313
const items = React.useMemo(() => {
1414
return Array.from({ length: 100 }, (_, i) => {
1515
return (
@@ -21,71 +21,60 @@ const MarqueeAccordion: React.FC = () => {
2121
});
2222
}, []);
2323

24-
const onMarqueeCycleComplete = () => {
25-
if (marqueeKey === 0) {
26-
setMarqueeKey(1);
27-
} else {
28-
setMarqueeKey(0);
29-
}
30-
};
31-
3224
return (
33-
<Marquee key={marqueeKey} onCycleComplete={onMarqueeCycleComplete} loop={0} speed={30} style={{ width: "100%", margin: 0, padding: 0 }}>
25+
// <Stack sx={{ maxWidth: "90%" }}>
26+
<Marquee loop={0} gradient={true} gradientWidth={marqueeGradientWidth} speed={30} style={{ width: marqueeWidth }}>
3427
{items}
3528
</Marquee>
29+
// </Stack>
3630
);
3731
};
3832

39-
export const MobilePageAccordion: React.FC = () => {
33+
export const MobileAccordion: React.FC = () => {
4034
const { language } = useAppContext();
4135
const [expanded, setExpanded] = React.useState<boolean>(false);
42-
const venue = language === "ko" ? "서울특별시 중구 필동로 1길 30 동국대학교 신공학관" : "New Engineering Building, Dongguk University";
43-
44-
const a = "Pildong-ro 1-gil, Jung-gu, Seoul, Republic of Korea";
4536

4637
return (
4738
<AccordionWrapper>
48-
<StyledAccordion expanded={expanded} onChange={() => setExpanded((prev) => !prev)}>
49-
{!expanded && (
50-
<AccordionSummary
51-
sx={{}}
52-
expandIcon={
53-
<ExpandMoreIcon
54-
sx={{
55-
position: "absolute",
56-
right: 0,
57-
transform: "translateY(-50%)",
58-
}}
59-
/>
60-
}
61-
>
62-
{expanded ? null : <MarqueeAccordion />}
63-
</AccordionSummary>
64-
)}
39+
<StyledAccordion square={false} expanded={expanded} onChange={() => setExpanded((prev) => !prev)}>
40+
<AccordionSummary
41+
expandIcon={
42+
<ExpandMoreIcon
43+
fontSize={"large"}
44+
sx={{
45+
color: "#8E9B5D",
46+
borderWidth: 1,
47+
position: "relative",
48+
top: expanded ? -16 : 0,
49+
}}
50+
/>
51+
}
52+
sx={{ margin: 0, padding: 0 }}
53+
>
54+
{expanded ? null : <MarqueeAccordion />}
55+
</AccordionSummary>
6556
<StyledAccordionDetails>
66-
{expanded ? (
67-
<>
68-
<Stack sx={{ margin: 0, padding: 0, alignItems: "center", justifyContent: "center" }}>
69-
<img src={PyCon2025HostLogoBig} alt="PyCon 2025 Host Logo" style={{ width: "90%", height: "90%" }} />
57+
<Stack>
58+
<Stack sx={{ padding: "30px 0px", borderRadius: "16px", alignItems: "center", justifyContent: "center" }}>
59+
<img src={PyCon2025HostLogoBig} alt="PyCon 2025 Host Logo" style={{ width: "90%", height: "90%" }} />
60+
</Stack>
61+
{language === "ko" ? (
62+
<Stack direction="column" sx={{ transform: "translateY(-280%)" }}>
63+
<Typography color="#938A85" textAlign="center" fontSize="11px" fontWeight={400}>
64+
{"서울특별시 중구 필동로 1길 30 동국대학교 신공학관"}
65+
</Typography>
66+
</Stack>
67+
) : (
68+
<Stack direction="column" sx={{ transform: "translateY(-180%)" }}>
69+
<Typography color="#938A85" textAlign="center" fontSize="10px" fontWeight={400}>
70+
{"New Engineering Building, Dongguk University"}
71+
</Typography>
72+
<Typography color="#938A85" textAlign="center" fontWeight={400} fontSize="10px">
73+
{"Pildong-ro 1-gil, Jung-gu, Seoul, Republic of Korea"}
74+
</Typography>
7075
</Stack>
71-
{language === "ko" ? (
72-
<Stack direction="column" sx={{ transform: "translateY(-150%)" }}>
73-
<Typography color="#938A85" textAlign="center" fontSize="12px" fontWeight={400}>
74-
{"서울특별시 중구 필동로 1길 30 동국대학교 신공학관"}
75-
</Typography>
76-
</Stack>
77-
) : (
78-
<Stack direction="column" sx={{ transform: "translateY(-110%)" }}>
79-
<Typography color="#938A85" textAlign="center" fontSize="10px" fontWeight={400}>
80-
{"New Engineering Building, Dongguk University"}
81-
</Typography>
82-
<Typography color="#938A85" textAlign="center" fontWeight={400} fontSize="10px">
83-
{"Pildong-ro 1-gil, Jung-gu, Seoul, Republic of Korea"}
84-
</Typography>
85-
</Stack>
86-
)}
87-
</>
88-
) : null}
76+
)}
77+
</Stack>
8978
</StyledAccordionDetails>
9079
</StyledAccordion>
9180
</AccordionWrapper>
@@ -95,14 +84,17 @@ export const MobilePageAccordion: React.FC = () => {
9584
const AccordionWrapper = styled.div`
9685
display: flex;
9786
flex-direction: column;
98-
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
87+
box-shadow:
88+
0 4px 16px rgba(0, 0, 0, 0.1),
89+
0 -4px 16px rgba(0, 0, 0, 0.1);
9990
margin: 0;
10091
padding: 0;
92+
border-radius: 16;
10193
`;
10294

10395
const StyledAccordion = styled(MuiAccordion)`
10496
box-shadow: none;
105-
border-radius: 16px;
97+
border-radius: 16;
10698
10799
&:before {
108100
display: none;
@@ -121,7 +113,7 @@ const StyledAccordion = styled(MuiAccordion)`
121113
}
122114
123115
.MuiAccordionSummary-root {
124-
padding: 10px 35px;
116+
padding: 10px 0px 10px 0px;
125117
min-height: 60px;
126118
max-height: 60px;
127119
@@ -132,25 +124,28 @@ const StyledAccordion = styled(MuiAccordion)`
132124
}
133125
134126
&.Mui-expanded {
135-
min-height: 60px;
136-
max-height: 60px;
127+
min-height: 0px;
128+
max-height: 0px;
137129
object-fit: contain;
138130
}
139131
}
140132
141-
'& .MuiAccordionSummary-expandIconWrapper': {
142-
position: 'absolute',
143-
left: 8,
144-
top: '50%',
145-
transform: 'translateY(-50%)'
146-
},
133+
"& .muiaccordionsummary-expandiconwrapper": {
134+
position: 'absolute',
135+
top: 10;
136+
}
137+
138+
,
139+
.MuiAccordionDetails-root {
140+
margin: 6px 0px 24px 0px;
141+
}
147142
148143
width: 100%;
149144
max-width: 100vw;
150145
box-sizing: border-box;
151146
position: relative;
152-
margin: 0;
153-
padding: 0;
147+
marginleft: 0;
148+
paddingleft: 0;
154149
`;
155150

156151
const StyledTypography = styled(Typography)`
@@ -162,7 +157,6 @@ const StyledTypography = styled(Typography)`
162157
`;
163158

164159
const StyledAccordionDetails = styled(AccordionDetails)`
165-
border-radius: 16px;
166160
font-size: 14px;
167161
font-weight: 400;
168162
width: 100%;

0 commit comments

Comments
 (0)