Skip to content

Commit a5a852d

Browse files
committed
migrate docs layout to tailwind
1 parent f5a6de0 commit a5a852d

File tree

1 file changed

+13
-70
lines changed

1 file changed

+13
-70
lines changed

src/layouts/Docs.tsx

Lines changed: 13 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
import { useRouter } from "next/router"
22
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"
144

155
import { ChildOnlyProp } from "@/lib/types"
166
import type { DocsFrontmatter, MdPageContent } from "@/lib/interfaces"
@@ -27,47 +17,33 @@ import FeedbackCard from "@/components/FeedbackCard"
2717
import FileContributors from "@/components/FileContributors"
2818
import GlossaryTooltip from "@/components/Glossary/GlossaryTooltip"
2919
import InfoBanner from "@/components/InfoBanner"
30-
import Link from "@/components/Link"
3120
import MainArticle from "@/components/MainArticle"
3221
import {
3322
Heading1 as MdHeading1,
3423
Heading2 as MdHeading2,
3524
Heading3 as MdHeading3,
3625
Heading4 as MdHeading4,
37-
Paragraph,
3826
} from "@/components/MdComponents"
3927
import RollupProductDevDoc from "@/components/RollupProductDevDoc"
4028
import SideNav from "@/components/SideNav"
4129
import SideNavMobile from "@/components/SideNavMobile"
4230
import TableOfContents from "@/components/TableOfContents"
4331
import Translation from "@/components/Translation"
4432
import { Divider } from "@/components/ui/divider"
33+
import InlineLink from "@/components/ui/Link"
4534
import { mdxTableComponents } from "@/components/ui/Table"
4635
import YouTube from "@/components/YouTube"
4736

4837
import { cn } from "@/lib/utils/cn"
4938
import { getEditPath } from "@/lib/utils/editPath"
5039

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-
/>
40+
const Page = (props: HTMLAttributes<HTMLDivElement>) => (
41+
<div className="flex w-full flex-col border-b" {...props} />
5942
)
6043

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"
44+
const ContentContainer = (props: HTMLAttributes<HTMLDivElement>) => (
45+
<div
46+
className="flex justify-between bg-background-highlight lg:pe-8"
7147
{...props}
7248
/>
7349
)
@@ -101,61 +77,28 @@ const H4 = (props: HTMLAttributes<HTMLHeadingElement>) => (
10177
<MdHeading4 className={baseSubHeadingClasses} {...props} />
10278
)
10379

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
11280
const Content = (props: ChildOnlyProp) => {
113-
const mdBreakpoint = useToken("breakpoints", "md")
114-
11581
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-
}}
82+
<MainArticle
83+
className="min-w-0 flex-1 px-8 pb-8 pt-8 md:px-16 md:pb-16 md:pt-12"
13184
{...props}
13285
/>
13386
)
13487
}
13588

13689
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">
90+
<div className="display-none mt-12 flex border-t pt-8" {...props}>
91+
<InlineLink href="#top">
14692
<Translation id="back-to-top" />
147-
</Link>
148-
</Flex>
93+
</InlineLink>
94+
</div>
14995
)
15096

15197
export const docsComponents = {
15298
h1: H1,
15399
h2: H2,
154100
h3: H3,
155101
h4: H4,
156-
p: Paragraph,
157-
ul: UnorderedList,
158-
ol: OrderedList,
159102
pre: Codeblock,
160103
...mdxTableComponents,
161104
Badge,

0 commit comments

Comments
 (0)