Skip to content

Commit 86f806b

Browse files
committed
restor mdx route
1 parent b7de7a6 commit 86f806b

4 files changed

Lines changed: 42 additions & 7 deletions

File tree

app/routes/Guides.res

Lines changed: 0 additions & 3 deletions
This file was deleted.

app/routes/MdxRoute.res

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,46 @@ type loaderData = {
1212
filePath: option<string>,
1313
}
1414

15+
/**
16+
This configures the MDX component to use our custom markdown components
17+
*/
18+
let components = {
19+
// Replacing HTML defaults
20+
"a": Markdown.A.make,
21+
"blockquote": Markdown.Blockquote.make,
22+
"code": Markdown.Code.make,
23+
"h1": Markdown.H1.make,
24+
"h2": Markdown.H2.make,
25+
"h3": Markdown.H3.make,
26+
"h4": Markdown.H4.make,
27+
"h5": Markdown.H5.make,
28+
"hr": Markdown.Hr.make,
29+
"intro": Markdown.Intro.make,
30+
"li": Markdown.Li.make,
31+
"ol": Markdown.Ol.make,
32+
"p": Markdown.P.make,
33+
"pre": Markdown.Pre.make,
34+
"strong": Markdown.Strong.make,
35+
"table": Markdown.Table.make,
36+
"th": Markdown.Th.make,
37+
"thead": Markdown.Thead.make,
38+
"td": Markdown.Td.make,
39+
"ul": Markdown.Ul.make,
40+
// These are custom components we provide
41+
"Cite": Markdown.Cite.make,
42+
"CodeTab": Markdown.CodeTab.make,
43+
"Image": Markdown.Image.make,
44+
"Info": Markdown.Info.make,
45+
"Intro": Markdown.Intro.make,
46+
"UrlBox": Markdown.UrlBox.make,
47+
"Video": Markdown.Video.make,
48+
"Warn": Markdown.Warn.make,
49+
"CommunityContent": CommunityContent.make,
50+
"WarningTable": WarningTable.make,
51+
"Docson": DocsonLazy.make,
52+
"Suspense": React.Suspense.make,
53+
}
54+
1555
let convertToNavItems = (items, rootPath) =>
1656
Array.map(items, (item): SidebarLayout.Sidebar.NavItem.t => {
1757
let href = switch item.slug {
@@ -242,7 +282,7 @@ let loader: ReactRouter.Loader.t<loaderData> = async ({request}) => {
242282

243283
let default = () => {
244284
let {pathname} = ReactRouter.useLocation()
245-
let component = useMdxComponent(~components=Mdx.components)
285+
let component = useMdxComponent(~components)
246286
let attributes = useMdxAttributes()
247287

248288
let loaderData: loaderData = ReactRouter.useLoaderData()

src/layouts/SidebarLayout.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ let make = (
370370
<div className={"min-w-320 " ++ theme}>
371371
<div className="w-full">
372372
<div className="flex lg:justify-center">
373-
<div className="flex w-full max-w-1280 md:mx-10">
373+
<div className="flex w-full max-w-1280 md:mx-10 md:mt-16">
374374
sidebar
375375
<main className="px-4 w-full pt-4 md:ml-12 lg:mr-8 mb-32 md:max-w-576 lg:max-w-740">
376376
//width of the right content part

vite.config.mjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// @ts-check
2-
31
import { reactRouter } from "@react-router/dev/vite";
42
import tailwindcss from "@tailwindcss/vite";
53
import react from "@vitejs/plugin-react";

0 commit comments

Comments
 (0)