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
- Kbd ,
9
- Text ,
10
- type TextProps ,
11
- useToken ,
12
- } from "@chakra-ui/react"
3
+ import { Badge } from "@chakra-ui/react"
13
4
14
5
import type { ChildOnlyProp } from "@/lib/types"
15
6
import type { MdPageContent , TutorialFrontmatter } from "@/lib/interfaces"
@@ -22,7 +13,6 @@ import Emoji from "@/components/Emoji"
22
13
import EnvWarningBanner from "@/components/EnvWarningBanner"
23
14
import FeedbackCard from "@/components/FeedbackCard"
24
15
import FileContributors from "@/components/FileContributors"
25
- import GlossaryTooltip from "@/components/Glossary/GlossaryTooltip"
26
16
import InfoBanner from "@/components/InfoBanner"
27
17
import MainArticle from "@/components/MainArticle"
28
18
import {
@@ -34,33 +24,16 @@ import {
34
24
import TableOfContents from "@/components/TableOfContents"
35
25
import TooltipLink from "@/components/TooltipLink"
36
26
import TutorialMetadata from "@/components/TutorialMetadata"
37
- import { Divider } from "@/components/ui/divider"
38
27
import { mdxTableComponents } from "@/components/ui/Table"
39
28
import YouTube from "@/components/YouTube"
40
29
41
30
import { getEditPath } from "@/lib/utils/editPath"
42
31
43
- type ContentContainerProps = Pick < BoxProps , "children" | "dir" >
44
-
45
- const ContentContainer = ( props : ContentContainerProps ) => {
46
- const boxShadow = useToken ( "colors" , "tableBoxShadow" )
47
-
32
+ const ContentContainer = ( props : HTMLAttributes < HTMLDivElement > ) => {
48
33
return (
49
- < Box
50
- as = { MainArticle }
51
- maxW = "1000px"
52
- minW = { 0 }
53
- background = "background.base"
54
- boxShadow = { { base : "none" , lg : boxShadow } }
55
- m = { { base : "2.5rem 0rem" , lg : "2rem 2rem 6rem" } }
56
- p = { { base : "3rem 2rem" , lg : 16 } }
57
- borderRadius = "4px"
34
+ < MainArticle
35
+ className = "min-w-0 max-w-[1000px] rounded bg-background p-0 lg:p-16 lg:shadow"
58
36
{ ...props }
59
- sx = { {
60
- ".citation" : {
61
- p : { color : "text200" } ,
62
- } ,
63
- } }
64
37
/>
65
38
)
66
39
}
@@ -93,25 +66,16 @@ const Heading4 = (props: HTMLAttributes<HTMLHeadingElement>) => (
93
66
/>
94
67
)
95
68
96
- const StyledDivider = ( props ) => < Divider { ...props } />
97
-
98
- const Paragraph = ( props : TextProps ) => (
99
- < Text as = "p" mt = { 8 } mb = { 4 } mx = { 0 } color = "text300" fontSize = "md" { ...props } />
69
+ const Paragraph = ( props : HTMLAttributes < HTMLParagraphElement > ) => (
70
+ < p className = "mx-0 mb-4 mt-8" { ...props } />
100
71
)
101
72
102
- const KBD = ( props ) => {
103
- const borderColor = useToken ( "colors" , "primary.base" )
104
-
105
- return (
106
- < Kbd
107
- verticalAlign = "middle"
108
- p = "0.15rem 0.45rem"
109
- borderRadius = "2px"
110
- border = { `1px solid ${ borderColor } ` }
111
- { ...props }
112
- />
113
- )
114
- }
73
+ const KBD = ( props : HTMLAttributes < HTMLElement > ) => (
74
+ < kbd
75
+ className = "rounded-sm border-2 border-primary px-2 py-0.5 align-middle"
76
+ { ...props }
77
+ />
78
+ )
115
79
116
80
export const tutorialsComponents = {
117
81
a : TooltipLink ,
@@ -129,9 +93,7 @@ export const tutorialsComponents = {
129
93
Card,
130
94
Emoji,
131
95
EnvWarningBanner,
132
- GlossaryTooltip,
133
96
InfoBanner,
134
- StyledDivider,
135
97
YouTube,
136
98
}
137
99
type TutorialLayoutProps = ChildOnlyProp &
@@ -153,44 +115,34 @@ export const TutorialLayout = ({
153
115
const { asPath : relativePath } = useRouter ( )
154
116
const absoluteEditPath = getEditPath ( relativePath )
155
117
156
- const borderColor = useToken ( "colors" , "border" )
157
-
158
118
return (
159
- < >
160
- < Flex
161
- w = "100%"
162
- borderBottom = { `1px solid ${ borderColor } ` }
163
- m = { { base : "2rem 0rem" , lg : "0 auto" } }
164
- p = { { base : "0" , lg : "0 2rem 0 0" } }
165
- background = { { base : "background.base" , lg : "ednBackground" } }
166
- >
167
- < ContentContainer dir = { contentNotTranslated ? "ltr" : "unset" } >
168
- < Heading1 > { frontmatter . title } </ Heading1 >
169
- < TutorialMetadata frontmatter = { frontmatter } timeToRead = { timeToRead } />
170
- < TableOfContents
171
- items = { tocItems }
172
- maxDepth = { frontmatter . sidebarDepth ! }
173
- editPath = { absoluteEditPath }
174
- isMobile
175
- pt = { 8 }
176
- />
177
- { children }
178
- < FileContributors
179
- contributors = { contributors }
180
- lastEditLocaleTimestamp = { lastEditLocaleTimestamp }
181
- />
182
- < FeedbackCard />
183
- </ ContentContainer >
184
- { tocItems && (
185
- < TableOfContents
186
- items = { tocItems }
187
- maxDepth = { frontmatter . sidebarDepth ! }
188
- editPath = { absoluteEditPath }
189
- hideEditButton = { ! ! frontmatter . hideEditButton }
190
- pt = { 16 }
191
- />
192
- ) }
193
- </ Flex >
194
- </ >
119
+ < div className = "flex w-full gap-8 border-b bg-background p-8 lg:mx-auto lg:bg-background-highlight lg:shadow" >
120
+ < ContentContainer dir = { contentNotTranslated ? "ltr" : "unset" } >
121
+ < Heading1 > { frontmatter . title } </ Heading1 >
122
+ < TutorialMetadata frontmatter = { frontmatter } timeToRead = { timeToRead } />
123
+ < TableOfContents
124
+ items = { tocItems }
125
+ maxDepth = { frontmatter . sidebarDepth ! }
126
+ editPath = { absoluteEditPath }
127
+ isMobile
128
+ pt = { 8 }
129
+ />
130
+ { children }
131
+ < FileContributors
132
+ contributors = { contributors }
133
+ lastEditLocaleTimestamp = { lastEditLocaleTimestamp }
134
+ />
135
+ < FeedbackCard />
136
+ </ ContentContainer >
137
+ { tocItems && (
138
+ < TableOfContents
139
+ items = { tocItems }
140
+ maxDepth = { frontmatter . sidebarDepth ! }
141
+ editPath = { absoluteEditPath }
142
+ hideEditButton = { ! ! frontmatter . hideEditButton }
143
+ pt = { 8 }
144
+ />
145
+ ) }
146
+ </ div >
195
147
)
196
148
}
0 commit comments