1- import { Box , CircularProgress , Stack , Theme } from "@mui/material" ;
1+ import { CircularProgress , Stack , Theme } from "@mui/material" ;
22import { ErrorBoundary , Suspense } from "@suspensive/react" ;
33import { AxiosError , AxiosResponse } from "axios" ;
44import * as React from "react" ;
@@ -15,18 +15,49 @@ import { MDXRenderer } from "./mdx";
1515const 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
2638const 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
3263const 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 >
0 commit comments