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,37 +24,11 @@ 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
-
48
- 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"
58
- { ...props }
59
- sx = { {
60
- ".citation" : {
61
- p : { color : "text200" } ,
62
- } ,
63
- } }
64
- />
65
- )
66
- }
67
-
68
32
const Heading1 = ( props : HTMLAttributes < HTMLHeadingElement > ) => (
69
33
< MdHeading1
70
34
className = "font-monospace uppercase max-lg:text-[1.75rem]"
@@ -93,25 +57,16 @@ const Heading4 = (props: HTMLAttributes<HTMLHeadingElement>) => (
93
57
/>
94
58
)
95
59
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 } />
60
+ const Paragraph = ( props : HTMLAttributes < HTMLParagraphElement > ) => (
61
+ < p className = "mx-0 mb-4 mt-8" { ...props } />
100
62
)
101
63
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
- }
64
+ const KBD = ( props : HTMLAttributes < HTMLElement > ) => (
65
+ < kbd
66
+ className = "rounded-sm border-2 border-primary px-2 py-0.5 align-middle"
67
+ { ...props }
68
+ />
69
+ )
115
70
116
71
export const tutorialsComponents = {
117
72
a : TooltipLink ,
@@ -129,9 +84,7 @@ export const tutorialsComponents = {
129
84
Card,
130
85
Emoji,
131
86
EnvWarningBanner,
132
- GlossaryTooltip,
133
87
InfoBanner,
134
- StyledDivider,
135
88
YouTube,
136
89
}
137
90
type TutorialLayoutProps = ChildOnlyProp &
@@ -153,44 +106,37 @@ export const TutorialLayout = ({
153
106
const { asPath : relativePath } = useRouter ( )
154
107
const absoluteEditPath = getEditPath ( relativePath )
155
108
156
- const borderColor = useToken ( "colors" , "border" )
157
-
158
109
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" } }
110
+ < div className = "flex w-full gap-8 border-b bg-background p-8 lg:mx-auto lg:bg-background-highlight lg:shadow" >
111
+ < MainArticle
112
+ className = "min-w-0 max-w-[1000px] rounded bg-background p-0 lg:p-16 lg:shadow"
113
+ dir = { contentNotTranslated ? "ltr" : "unset" }
166
114
>
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
- </ >
115
+ < Heading1 > { frontmatter . title } </ Heading1 >
116
+ < TutorialMetadata frontmatter = { frontmatter } timeToRead = { timeToRead } />
117
+ < TableOfContents
118
+ items = { tocItems }
119
+ maxDepth = { frontmatter . sidebarDepth ! }
120
+ editPath = { absoluteEditPath }
121
+ isMobile
122
+ pt = { 8 }
123
+ />
124
+ { children }
125
+ < FileContributors
126
+ contributors = { contributors }
127
+ lastEditLocaleTimestamp = { lastEditLocaleTimestamp }
128
+ />
129
+ < FeedbackCard />
130
+ </ MainArticle >
131
+ { tocItems && (
132
+ < TableOfContents
133
+ items = { tocItems }
134
+ maxDepth = { frontmatter . sidebarDepth ! }
135
+ editPath = { absoluteEditPath }
136
+ hideEditButton = { ! ! frontmatter . hideEditButton }
137
+ pt = { 8 }
138
+ />
139
+ ) }
140
+ </ div >
195
141
)
196
142
}
0 commit comments