1
1
import { useRouter } from "next/router"
2
2
import type { HTMLAttributes } from "react"
3
- import {
4
- Badge ,
5
- Box ,
6
- type BoxProps ,
7
- Flex ,
8
- type FlexProps ,
9
- type ListProps ,
10
- OrderedList as ChakraOrderedList ,
11
- UnorderedList as ChakraUnorderedList ,
12
- useToken ,
13
- } from "@chakra-ui/react"
3
+ import { Badge } from "@chakra-ui/react"
14
4
15
5
import { ChildOnlyProp } from "@/lib/types"
16
6
import type { DocsFrontmatter , MdPageContent } from "@/lib/interfaces"
@@ -27,51 +17,26 @@ import FeedbackCard from "@/components/FeedbackCard"
27
17
import FileContributors from "@/components/FileContributors"
28
18
import GlossaryTooltip from "@/components/Glossary/GlossaryTooltip"
29
19
import InfoBanner from "@/components/InfoBanner"
30
- import Link from "@/components/Link"
31
20
import MainArticle from "@/components/MainArticle"
32
21
import {
33
22
Heading1 as MdHeading1 ,
34
23
Heading2 as MdHeading2 ,
35
24
Heading3 as MdHeading3 ,
36
25
Heading4 as MdHeading4 ,
37
- Paragraph ,
38
26
} from "@/components/MdComponents"
39
27
import RollupProductDevDoc from "@/components/RollupProductDevDoc"
40
28
import SideNav from "@/components/SideNav"
41
29
import SideNavMobile from "@/components/SideNavMobile"
42
30
import TableOfContents from "@/components/TableOfContents"
43
31
import Translation from "@/components/Translation"
44
32
import { Divider } from "@/components/ui/divider"
33
+ import InlineLink from "@/components/ui/Link"
45
34
import { mdxTableComponents } from "@/components/ui/Table"
46
35
import YouTube from "@/components/YouTube"
47
36
48
37
import { cn } from "@/lib/utils/cn"
49
38
import { getEditPath } from "@/lib/utils/editPath"
50
39
51
- const Page = ( props : ChildOnlyProp & Pick < FlexProps , "dir" > ) => (
52
- < Flex
53
- direction = "column"
54
- w = "full"
55
- borderBottom = "1px"
56
- borderColor = "border"
57
- { ...props }
58
- />
59
- )
60
-
61
- type ContentContainerProps = Pick < BoxProps , "children" | "dir" >
62
-
63
- const ContentContainer = ( props : ContentContainerProps ) => (
64
- < Flex
65
- justify = { "space-between" }
66
- w = "full"
67
- py = { 0 }
68
- ps = { 0 }
69
- pe = { { base : 0 , lg : 8 } }
70
- backgroundColor = "ednBackground"
71
- { ...props }
72
- />
73
- )
74
-
75
40
const baseHeadingClasses = "font-mono uppercase font-bold scroll-mt-40"
76
41
77
42
const H1 = ( props : HTMLAttributes < HTMLHeadingElement > ) => (
@@ -101,61 +66,19 @@ const H4 = (props: HTMLAttributes<HTMLHeadingElement>) => (
101
66
< MdHeading4 className = { baseSubHeadingClasses } { ...props } />
102
67
)
103
68
104
- const UnorderedList = ( props : ListProps ) => (
105
- < ChakraUnorderedList ms = "1.45rem" { ...props } />
106
- )
107
- const OrderedList = ( props : ListProps ) => (
108
- < ChakraOrderedList ms = "1.45rem" { ...props } />
109
- )
110
-
111
- // Apply styles for classes within markdown here
112
- const Content = ( props : ChildOnlyProp ) => {
113
- const mdBreakpoint = useToken ( "breakpoints" , "md" )
114
-
115
- return (
116
- < Box
117
- as = { MainArticle }
118
- flex = { `1 1 ${ mdBreakpoint } ` }
119
- w = { { base : "full" , lg : "0" } }
120
- pt = { { base : 8 , md : 12 } }
121
- pb = { { base : 8 , md : 16 } }
122
- px = { { base : 8 , md : 16 } }
123
- m = "0 auto"
124
- sx = { {
125
- ".citation" : {
126
- p : {
127
- color : "text200" ,
128
- } ,
129
- } ,
130
- } }
131
- { ...props }
132
- />
133
- )
134
- }
135
-
136
69
const BackToTop = ( props : ChildOnlyProp ) => (
137
- < Flex
138
- display = { { lg : "none" } }
139
- mt = { 12 }
140
- pt = { 8 }
141
- borderTop = "1px"
142
- borderColor = "border"
143
- { ...props }
144
- >
145
- < Link href = "#top" >
70
+ < div className = "display-none mt-12 flex border-t pt-8" { ...props } >
71
+ < InlineLink href = "#top" >
146
72
< Translation id = "back-to-top" /> ↑
147
- </ Link >
148
- </ Flex >
73
+ </ InlineLink >
74
+ </ div >
149
75
)
150
76
151
77
export const docsComponents = {
152
78
h1 : H1 ,
153
79
h2 : H2 ,
154
80
h3 : H3 ,
155
81
h4 : H4 ,
156
- p : Paragraph ,
157
- ul : UnorderedList ,
158
- ol : OrderedList ,
159
82
pre : Codeblock ,
160
83
...mdxTableComponents ,
161
84
Badge,
@@ -197,16 +120,19 @@ export const DocsLayout = ({
197
120
const absoluteEditPath = getEditPath ( relativePath )
198
121
199
122
return (
200
- < Page >
123
+ < div className = "flex w-full flex-col border-b" >
201
124
< SideNavMobile path = { relativePath } />
202
125
{ isPageIncomplete && (
203
126
< BannerNotification shouldShow = { isPageIncomplete } >
204
127
< Translation id = "page-developers-docs:banner-page-incomplete" />
205
128
</ BannerNotification >
206
129
) }
207
- < ContentContainer dir = { contentNotTranslated ? "ltr" : "unset" } >
130
+ < div
131
+ className = "flex justify-between bg-background-highlight lg:pe-8"
132
+ dir = { contentNotTranslated ? "ltr" : "unset" }
133
+ >
208
134
< SideNav path = { relativePath } />
209
- < Content >
135
+ < MainArticle className = "min-w-0 flex-1 px-8 pb-8 pt-8 md:px-16 md:pb-16 md:pt-12" >
210
136
< H1 id = "top" > { frontmatter . title } </ H1 >
211
137
< FileContributors
212
138
contributors = { contributors }
@@ -224,7 +150,7 @@ export const DocsLayout = ({
224
150
< BackToTop />
225
151
< FeedbackCard isArticle />
226
152
< DocsNav contentNotTranslated = { contentNotTranslated } />
227
- </ Content >
153
+ </ MainArticle >
228
154
{ tocItems && (
229
155
< TableOfContents
230
156
editPath = { absoluteEditPath }
@@ -234,7 +160,7 @@ export const DocsLayout = ({
234
160
pt = { isPageIncomplete ? "5rem" : "3rem" }
235
161
/>
236
162
) }
237
- </ ContentContainer >
238
- </ Page >
163
+ </ div >
164
+ </ div >
239
165
)
240
166
}
0 commit comments