Skip to content

Commit 015b3e2

Browse files
committed
feat: mobile accordion 중간작업
1 parent 35a1334 commit 015b3e2

File tree

1 file changed

+79
-34
lines changed

1 file changed

+79
-34
lines changed

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

Lines changed: 79 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,85 @@ import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
33
import { AccordionDetails, AccordionSummary, Accordion as MuiAccordion, Stack, Typography } from "@mui/material";
44
import * as React from "react";
55
import Marquee from "react-fast-marquee";
6+
import { useAppContext } from "../../../../../apps/pyconkr/src/contexts/app_context";
67
import PyCon2025HostLogoBig from "../../assets/pyconkr2025_hostlogo_big.png";
78
import PyCon2025HostLogoSmall from "../../assets/pyconkr2025_hostlogo_small.png";
89

9-
const AccordionExpandedStyle: React.CSSProperties = {
10-
backgroundColor: "white",
11-
overflow: "hidden",
12-
};
13-
1410
const MarqueeAccordion: React.FC = () => {
15-
return (
16-
<Marquee loop={0}>
17-
<Stack direction={"row"} sx={{ gap: "1.5rem" }}>
18-
<Stack direction={"row"} sx={{ gap: "1.5rem" }}>
19-
<StyledTypography>{"AUG 15 - 17"}</StyledTypography>
20-
<img src={PyCon2025HostLogoSmall} />
21-
</Stack>
22-
<Stack direction={"row"} sx={{ gap: "1.5rem" }}>
11+
const [marqueeKey, setMarqueeKey] = React.useState<number>(0);
12+
13+
const items = React.useMemo(() => {
14+
return Array.from({ length: 100 }, (_, i) => {
15+
return (
16+
<Stack direction={"row"} sx={{ gap: 0 }}>
2317
<StyledTypography>{"AUG 15 - 17"}</StyledTypography>
2418
<img src={PyCon2025HostLogoSmall} />
2519
</Stack>
26-
</Stack>
20+
);
21+
});
22+
}, []);
23+
24+
const onMarqueeCycleComplete = () => {
25+
if (marqueeKey === 0) {
26+
setMarqueeKey(1);
27+
} else {
28+
setMarqueeKey(0);
29+
}
30+
};
31+
32+
return (
33+
<Marquee key={marqueeKey} onCycleComplete={onMarqueeCycleComplete} loop={0} speed={30} style={{ width: "100%", margin: 0, padding: 0 }}>
34+
{items}
2735
</Marquee>
2836
);
2937
};
3038

3139
export const MobilePageAccordion: React.FC = () => {
40+
const { language } = useAppContext();
3241
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";
3345

3446
return (
3547
<AccordionWrapper>
3648
<StyledAccordion expanded={expanded} onChange={() => setExpanded((prev) => !prev)}>
37-
<AccordionSummary sx={{ display: "flex" }} expandIcon={<ExpandMoreIcon />}>
38-
{expanded ? null : <MarqueeAccordion />}
39-
</AccordionSummary>
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+
)}
4065
<StyledAccordionDetails>
4166
{expanded ? (
42-
<Stack alignItems="center" justifyContent="center" sx={{ ...AccordionExpandedStyle }}>
43-
<img
44-
src={PyCon2025HostLogoBig}
45-
alt="PyCon 2025 Host Logo"
46-
style={{ backgroundColor: "white", objectFit: "cover", borderRadius: "50%" }}
47-
/>
67+
<Stack sx={{ objectFit: "contain", margin: 0, padding: 0 }}>
68+
<img src={PyCon2025HostLogoBig} alt="PyCon 2025 Host Logo" style={{ objectFit: "contain" }} />
69+
{language === "ko" ? (
70+
<Stack direction="column" sx={{ transform: "translateY(-150%)" }}>
71+
<Typography color="#938A85" textAlign="center" fontSize="12px" fontWeight={400}>
72+
{"서울특별시 중구 필동로 1길 30 동국대학교 신공학관"}
73+
</Typography>
74+
</Stack>
75+
) : (
76+
<Stack direction="column" sx={{ transform: "translateY(-80%)" }}>
77+
<Typography color="#938A85" textAlign="center" fontSize="12px" fontWeight={400}>
78+
{"New Engineering Building, Dongguk University"}
79+
</Typography>
80+
<Typography color="#938A85" textAlign="center" fontWeight={400} fontSize="12px">
81+
{"Pildong-ro 1-gil, Jung-gu, Seoul, Republic of Korea"}
82+
</Typography>
83+
</Stack>
84+
)}
4885
</Stack>
4986
) : null}
5087
</StyledAccordionDetails>
@@ -56,14 +93,7 @@ export const MobilePageAccordion: React.FC = () => {
5693
const AccordionWrapper = styled.div`
5794
display: flex;
5895
flex-direction: column;
59-
border-top: 1px solid ${({ theme }) => theme.palette.primary.dark};
60-
border-bottom: 1px solid ${({ theme }) => theme.palette.primary.dark};
61-
`;
62-
63-
const Divider = styled.div`
64-
height: 1px;
65-
background-color: ${({ theme }) => theme.palette.primary.light};
66-
margin: 0;
96+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
6797
`;
6898

6999
const StyledAccordion = styled(MuiAccordion)`
@@ -100,23 +130,38 @@ const StyledAccordion = styled(MuiAccordion)`
100130
&.Mui-expanded {
101131
min-height: 60px;
102132
max-height: 60px;
133+
object-fit: contain;
103134
}
104135
}
136+
137+
'& .MuiAccordionSummary-expandIconWrapper': {
138+
position: 'absolute',
139+
left: 8,
140+
top: '50%',
141+
transform: 'translateY(-50%)'
142+
},
143+
144+
width: 100%;
145+
max-width: 100vw;
146+
box-sizing: border-box;
147+
overflow: hidden;
148+
position: relative;
105149
`;
106150

107151
const StyledTypography = styled(Typography)`
108152
font-weight: 600;
109153
font-size: 1rem;
110154
color: #938a85;
111155
text-align: center;
156+
padding: 0 10px;
112157
`;
113158

114159
const StyledAccordionDetails = styled(AccordionDetails)`
115-
background-color: white;
116-
color: ${({ theme }) => theme.palette.primary.dark};
160+
border-radius: 16px;
117161
font-size: 14px;
118162
font-weight: 400;
119163
width: 100%;
120164
height: 100%;
121-
padding: 20px 0 20px calc(35px + 18px + 60px); // top right bottom left
165+
margin: 0;
166+
padding: 20;
122167
`;

0 commit comments

Comments
 (0)