Skip to content

Commit 1ab01ef

Browse files
committed
feat: Date Component 부분개발
1 parent 2d8aea0 commit 1ab01ef

File tree

1 file changed

+45
-16
lines changed

1 file changed

+45
-16
lines changed

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

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Box, Button, Stack, styled, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Typography } from "@mui/material";
1+
import { Box, Button, ButtonBase, Stack, styled, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Typography } from "@mui/material";
22
import { ErrorBoundary, Suspense } from "@suspensive/react";
33
import * as React from "react";
44
import BackendAPISchemas from "../../schemas/backendAPI";
@@ -167,6 +167,24 @@ const rawSessionDates: SessionDate[] = [
167167
},
168168
];
169169

170+
const rawRooms: Room[] = [
171+
{
172+
name: "201호",
173+
availableStartDate: new Date(2025, 8, 15),
174+
availableEndDate: new Date(2025, 8, 16),
175+
},
176+
{
177+
name: "202호",
178+
availableStartDate: new Date(2025, 8, 16),
179+
availableEndDate: new Date(2025, 8, 17),
180+
},
181+
{
182+
name: "203호",
183+
availableStartDate: new Date(2025, 8, 16),
184+
availableEndDate: new Date(2025, 8, 17),
185+
},
186+
];
187+
170188
const SessionTimeTableItem: React.FC<{ data: SessionTimeTableSlotType }> = ({ data }) => {
171189
const sessionCategories = data.session.categories;
172190

@@ -206,19 +224,21 @@ export const SessionTimeTable: React.FC = ErrorBoundary.with(
206224
};
207225

208226
return (
209-
<Box>
210-
<SessionDateTabContainer>
211-
<StyledDivider />
227+
<Box sx={{ flexDirection: "column" }}>
228+
<ColoredDivider />
229+
<SessionDateTabContainer direction="row">
212230
{sessionDates.map((sessionDate) => {
213231
return (
214-
<SessionDateItemContainer direction="column">
215-
<SessionDateTitle children={"Day " + sessionDate.index} isSelected={sessionDate.date === selectedDate.date} />
216-
<SessionDateSubTitle children={convertLanguage(sessionDate)} isSelected={sessionDate.date === selectedDate.date} />
217-
</SessionDateItemContainer>
232+
<ButtonBase onClick={() => setSelectedDate(sessionDate)}>
233+
<SessionDateItemContainer direction="column">
234+
<SessionDateTitle children={"Day " + sessionDate.index} isSelected={sessionDate.date === selectedDate.date} />
235+
<SessionDateSubTitle children={convertLanguage(sessionDate)} isSelected={sessionDate.date === selectedDate.date} />
236+
</SessionDateItemContainer>
237+
</ButtonBase>
218238
);
219239
})}
220-
<StyledDivider />
221240
</SessionDateTabContainer>
241+
<ColoredDivider />
222242
</Box>
223243
);
224244
};
@@ -233,7 +253,7 @@ export const SessionTimeTable: React.FC = ErrorBoundary.with(
233253
// @ts-ignore
234254
const [selectedDate, setSelectedDate] = React.useState<SessionDate>(sessionDates[0]);
235255
// @ts-ignore
236-
const [sessionRooms, setSessionRooms] = React.useState<Room[]>([]);
256+
const [sessionRooms, setSessionRooms] = React.useState<Room[]>(rawRooms);
237257
const filteredSessions = React.useMemo(() => {
238258
return sessions.filter((session) => {
239259
return selectedDate.date.toLocaleDateString() === session.room_schedules.start_at.toLocaleDateString();
@@ -252,8 +272,12 @@ export const SessionTimeTable: React.FC = ErrorBoundary.with(
252272
return data;
253273
}, [filteredSessions, selectedDate]);
254274

275+
React.useEffect(() => {
276+
filteredSessionTimeTableSlots;
277+
});
278+
255279
return (
256-
<>
280+
<Box>
257281
<SessionDateTab />
258282
<TableContainer>
259283
<Table>
@@ -271,7 +295,7 @@ export const SessionTimeTable: React.FC = ErrorBoundary.with(
271295
</TableBody>
272296
</Table>
273297
</TableContainer>
274-
</>
298+
</Box>
275299
);
276300
})
277301
);
@@ -286,7 +310,7 @@ const SessionTimeTableItemTagContainer = styled(Stack)({
286310
justifyContent: "center",
287311
});
288312

289-
const SessionDateTabContainer = styled(Box)({
313+
const SessionDateTabContainer = styled(Stack)({
290314
alignItems: "center",
291315
justifyContent: "center",
292316
});
@@ -295,12 +319,13 @@ const SessionDateTabContainer = styled(Box)({
295319
const SessionDateItemContainer = styled(Stack)({
296320
alignItems: "center",
297321
justifyContent: "center",
322+
padding: "0.5rem 1.5rem",
298323
});
299324

300325
// @ts-ignore
301326
const SessionDateTitle = styled(Typography)<{ isSelected: boolean }>(({ theme, isSelected }) => ({
302327
fontSize: "1.5em",
303-
fontWeight: 400,
328+
fontWeight: 600,
304329
lineHeight: 1.25,
305330
textDecoration: "none",
306331
whiteSpace: "pre-wrap",
@@ -309,8 +334,8 @@ const SessionDateTitle = styled(Typography)<{ isSelected: boolean }>(({ theme, i
309334

310335
// @ts-ignore
311336
const SessionDateSubTitle = styled(Typography)<{ isSelected: boolean }>(({ theme, isSelected }) => ({
312-
fontSize: "1.5em",
313-
fontWeight: 400,
337+
fontSize: "0.75em",
338+
fontWeight: 600,
314339
lineHeight: 1.25,
315340
textDecoration: "none",
316341
whiteSpace: "pre-wrap",
@@ -349,3 +374,7 @@ const SpeakerName = styled(Typography)({
349374
textDecoration: "none",
350375
whiteSpace: "pre-wrap",
351376
});
377+
378+
const ColoredDivider = styled(StyledDivider)(({ theme }) => ({
379+
color: theme.palette.primary.main,
380+
}));

0 commit comments

Comments
 (0)