Skip to content

Commit 580d557

Browse files
committed
fix: 전반적인 여백 재조정
1 parent 249956c commit 580d557

File tree

2 files changed

+40
-14
lines changed

2 files changed

+40
-14
lines changed

packages/common/src/components/dynamic_route.tsx

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Box, CircularProgress, Stack, Theme } from "@mui/material";
1+
import { CircularProgress, Stack, Theme } from "@mui/material";
22
import { ErrorBoundary, Suspense } from "@suspensive/react";
33
import { AxiosError, AxiosResponse } from "axios";
44
import * as React from "react";
@@ -15,18 +15,49 @@ import { MDXRenderer } from "./mdx";
1515
const initialPageStyle: (additionalStyle: React.CSSProperties) => (theme: Theme) => React.CSSProperties =
1616
(additionalStyle) => (theme) => ({
1717
width: "100%",
18-
marginTop: theme.spacing(8),
1918
display: "flex",
20-
justifyContent: "center",
19+
justifyContent: "flex-start",
2120
alignItems: "center",
2221
flexDirection: "column",
22+
23+
marginTop: theme.spacing(8),
24+
25+
...(additionalStyle
26+
? additionalStyle
27+
: {
28+
[theme.breakpoints.down("md")]: {
29+
marginTop: theme.spacing(4),
30+
},
31+
[theme.breakpoints.down("sm")]: {
32+
marginTop: theme.spacing(2),
33+
},
34+
}),
2335
...additionalStyle,
2436
});
2537

2638
const initialSectionStyle: (additionalStyle: React.CSSProperties) => (theme: Theme) => React.CSSProperties =
27-
(additionalStyle) => () => ({
39+
(additionalStyle) => (theme) => ({
2840
width: "100%",
29-
...additionalStyle,
41+
maxWidth: "1000px",
42+
display: "flex",
43+
justifyContent: "flex-start",
44+
alignItems: "center",
45+
paddingRight: "2rem",
46+
paddingLeft: "2rem",
47+
48+
"& .markdown-body": { width: "100%" },
49+
...(additionalStyle
50+
? additionalStyle
51+
: {
52+
[theme.breakpoints.down("md")]: {
53+
paddingRight: "1rem",
54+
paddingLeft: "1rem",
55+
},
56+
[theme.breakpoints.down("sm")]: {
57+
paddingRight: "0.5rem",
58+
paddingLeft: "0.5rem",
59+
},
60+
}),
3061
});
3162

3263
const LoginRequired: React.FC = () => <>401 Login Required</>;
@@ -62,18 +93,12 @@ export const PageRenderer: React.FC<{ id?: string }> = ErrorBoundary.with(
6293
Suspense.with({ fallback: <CircularProgress /> }, ({ id }) => {
6394
const backendClient = Hooks.BackendAPI.useBackendClient();
6495
const { data } = Hooks.BackendAPI.usePageQuery(backendClient, id || "");
65-
const commonStackStyle = {
66-
justifyContent: "flex-start",
67-
alignItems: "center",
68-
};
6996

7097
return (
71-
<Stack {...commonStackStyle} sx={initialPageStyle(Utils.parseCss(data.css))}>
98+
<Stack sx={initialPageStyle(Utils.parseCss(data.css))}>
7299
{data.sections.map((s) => (
73-
<Stack {...commonStackStyle} sx={initialSectionStyle(Utils.parseCss(s.css))} key={s.id}>
74-
<Box sx={{ maxWidth: "1000px" }}>
75-
<MDXRenderer text={s.body} />
76-
</Box>
100+
<Stack sx={initialSectionStyle(Utils.parseCss(s.css))} key={s.id}>
101+
<MDXRenderer text={s.body} />
77102
</Stack>
78103
))}
79104
</Stack>

packages/common/src/components/mdx.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ const CustomMDXComponents: MDXComponents = {
5555
h6: (props) => <h6 style={{ margin: 0 }} {...props} />,
5656
strong: (props) => <strong {...props} />,
5757
hr: (props) => <StyledDivider {...props} />,
58+
img: (props) => <img style={{ maxWidth: "100%" }} alt="" {...props} />,
5859
em: (props) => <em {...props} />,
5960
ul: (props) => <ul {...props} />,
6061
ol: (props) => <ol {...props} />,

0 commit comments

Comments
 (0)