Skip to content

Commit d37eaa5

Browse files
committed
commented out links for now to suppress errors until I get all the links created and known
1 parent e9ce5cb commit d37eaa5

22 files changed

+439
-207
lines changed

app/routes.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ import * as Routes from "@react-router/dev/routes";
77
let $$default = Belt_Array.concatMany([
88
[
99
Routes.index("./routes/LandingPageRoute.mjs"),
10-
Routes.route("syntax-lookup", "./routes/SyntaxLookupRoute.mjs")
10+
Routes.route("try", "./routes/TryRoute.mjs"),
11+
Routes.route("community", "./routes/CommunityRoute.mjs"),
12+
Routes.route("syntax-lookup", "./routes/SyntaxLookupRoute.mjs"),
13+
Routes.route("blog", "./routes/BlogRoute.mjs")
1114
],
1215
Server.routes("./routes/MdxRoute.mjs")
1316
]);

app/routes.res

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ open ReactRouter.Mdx
33

44
let default = [
55
index("./routes/LandingPageRoute.mjs"),
6+
route("try", "./routes/TryRoute.mjs"),
7+
route("community", "./routes/CommunityRoute.mjs"),
68
route("syntax-lookup", "./routes/SyntaxLookupRoute.mjs"),
9+
route("blog", "./routes/BlogRoute.mjs"),
710
...routes("./routes/MdxRoute.mjs"),
8-
] // TODO: playground, blog, community,
11+
]

app/routes/BlogRoute.res

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@react.component
2+
let default = () => {
3+
React.string("Blog Route Placeholder")
4+
}

app/routes/CommunityRoute.res

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@react.component
2+
let default = () => {
3+
React.string("Community Route Placeholder")
4+
}

app/routes/TryRoute.res

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@react.component
2+
let default = () => {
3+
<div></div>
4+
}

generate-route-types.mjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import fs from "fs/promises";
2+
import { init } from "react-router-mdx/server";
3+
4+
init({ paths: ["_blogposts", "docs"], aliases: ["blog", "docs"] });
5+
6+
7+
8+
const { default: routes } = await import("./app/routes.mjs")
9+
10+
const paths = routes.map(route => `#"${route.path}"`).join(" |\n")
11+
12+
await fs.writeFile(
13+
"src/Path.res",
14+
`type t = [
15+
${paths}
16+
]
17+
`
18+
)

src/ApiDocs.res

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,13 @@ module SidebarTree = {
9595

9696
// Use ReactRouter's useLocation if needed, or refactor to not use router
9797
let location = ReactRouter.useLocation()
98-
let url = location.pathname->Url.parse
99-
let version = url->Url.getVersionString
98+
let url = ""
99+
// let url = location.pathname->Url.parse
100+
// let version = url->Url.getVersionString
101+
let version = ""
100102

101103
let moduleRoute =
102-
WebAPI.URL.make(~url="file://" ++ location.pathname).pathname
104+
WebAPI.URL.make(~url="file://" ++ "" /* TODO: location.pathname */).pathname
103105
->String.replace(`/docs/manual/${version}/api/`, "")
104106
->String.split("/")
105107

@@ -136,9 +138,9 @@ module SidebarTree = {
136138

137139
<details key={href} open_>
138140
<summary className={summaryClassName ++ classNameActive}>
139-
<Link className={"inline-block w-10/12"} to={(href :> ReactRouter.Link.to)}>
140-
{node.name->React.string}
141-
</Link>
141+
// <Link className={"inline-block w-10/12"} to={(href :> ReactRouter.Link.to)}>
142+
// {node.name->React.string}
143+
// </Link>
142144
</summary>
143145
tocModule
144146
{if hasChildren {
@@ -154,19 +156,20 @@ module SidebarTree = {
154156
| false =>
155157
<li className={"list-none mt-1 leading-4"} key={href}>
156158
<summary className={summaryClassName ++ classNameActive}>
157-
<Link className={"block"} to={(href :> ReactRouter.Link.to)}>
158-
{node.name->React.string}
159-
</Link>
159+
// <Link className={"block"} to={(href :> ReactRouter.Link.to)}>
160+
// {node.name->React.string}
161+
// </Link>
160162
</summary>
161163
tocModule
162164
</li>
163165
}
164166
}
165167

166-
let url =
167-
location.pathname
168-
->Url.parse
169-
->Some
168+
// TODO
169+
let url = None
170+
// location.pathname
171+
// ->Url.parse
172+
// ->Some
170173

171174
let preludeSection =
172175
<div className="flex justify-between text-fire font-medium items-baseline">
@@ -177,7 +180,8 @@ module SidebarTree = {
177180
ReactEvent.Form.preventDefault(evt)
178181
let version = (evt->ReactEvent.Form.target)["value"]
179182
WebAPI.Storage.setItem(localStorage, ~key=(Manual :> string), ~value=version)
180-
let url = Url.parse(location.pathname)
183+
let url = Url.parse("" /* TODO: location.pathname */)
184+
181185
switch url.pagepath[1] {
182186
| Some("core") | Some("stdlib") =>
183187
if version < "v12.0.0" {
@@ -230,12 +234,12 @@ module SidebarTree = {
230234
<div className="hl-overline block text-gray-80 mt-5 mb-2">
231235
{"Overview"->React.string}
232236
</div>
233-
<Link
234-
className={"block " ++
235-
summaryClassName ++ (moduleRoute->Array.length == 1 ? classNameActive : "")}
236-
to={(node.path->Array.join("/") :> ReactRouter.Link.to)}>
237-
{node.name->React.string}
238-
</Link>
237+
// <Link
238+
// className={"block " ++
239+
// summaryClassName ++ (moduleRoute->Array.length == 1 ? classNameActive : "")}
240+
// to={(node.path->Array.join("/") :> ReactRouter.Link.to)}>
241+
// {node.name->React.string}
242+
// </Link>
239243
{moduleRoute->Array.length === 1 ? subMenu : React.null}
240244
</div>
241245
<div className="hl-overline text-gray-80 mt-5 mb-2"> {"submodules"->React.string} </div>

src/Blog.res

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,23 @@ module CategorySelector = {
5151
let tabs = [All, Archived]
5252

5353
<div className="text-16 w-full flex items-center justify-between text-gray-60">
54-
{tabs
55-
->Array.map(tab => {
56-
// Deep comparison here!
57-
let isActive = selected == tab
58-
let text = (tab :> string)
59-
let href = switch tab {
60-
| All => "/blog"
61-
| Archived => "/blog/archived"
62-
}
63-
let className =
64-
switch isActive {
65-
| true => "bg-gray-20 text-gray-80 rounded py-1"
66-
| false => "hover:cursor-pointer bg-white hover:text-gray-80"
67-
} ++ " px-4 inline-block"
68-
<Link key=text to=Url(href) className> {React.string(text)} </Link>
69-
})
70-
->React.array}
54+
// {tabs
55+
// ->Array.map(tab => {
56+
// // Deep comparison here!
57+
// let isActive = selected == tab
58+
// let text = (tab :> string)
59+
// let href = switch tab {
60+
// | All => "/blog"
61+
// | Archived => "/blog/archived"
62+
// }
63+
// let className =
64+
// switch isActive {
65+
// | true => "bg-gray-20 text-gray-80 rounded py-1"
66+
// | false => "hover:cursor-pointer bg-white hover:text-gray-80"
67+
// } ++ " px-4 inline-block"
68+
// // <Link key=text to=Url(href) className> {React.string(text)} </Link>
69+
// })
70+
// ->React.array}
7171
</div>
7272
}
7373
}
@@ -85,27 +85,28 @@ module BlogCard = {
8585
) =>
8686
<section className="h-full">
8787
<div className="relative">
88+
// <ReactRouter.SafeLink to=#"syntax-lookup" />
8889
{switch badge {
8990
| None => React.null
9091
| Some(badge) =>
9192
<div className="absolute z-10 bottom-0 mb-4 -ml-2">
9293
<Badge badge />
9394
</div>
9495
}}
95-
<Link to=Url(`/blog/${slug}`) className="relative hl-title block mb-4 pt-9/16">
96-
{
97-
let className = "absolute top-0 h-full w-full object-cover"
98-
switch previewImg {
99-
| Some(src) => <img className src loading={#lazy} />
100-
| None => <img className src=defaultPreviewImg loading={#lazy} />
101-
}
102-
}
103-
</Link>
96+
// <Link to=Url(`/blog/${slug}`) className="relative hl-title block mb-4 pt-9/16">
97+
// {
98+
// let className = "absolute top-0 h-full w-full object-cover"
99+
// switch previewImg {
100+
// | Some(src) => <img className src loading={#lazy} />
101+
// | None => <img className src=defaultPreviewImg loading={#lazy} />
102+
// }
103+
// }
104+
// </Link>
104105
</div>
105106
<div className="px-2">
106-
<Link to=Url(`/blog/${slug}`)>
107-
<h2 className="hl-4"> {React.string(title)} </h2>
108-
</Link>
107+
// <Link to=Url(`/blog/${slug}`)>
108+
// <h2 className="hl-4"> {React.string(title)} </h2>
109+
// </Link>
109110
<div className="captions text-gray-40 pt-1">
110111
{switch category {
111112
| Some(category) =>
@@ -143,22 +144,22 @@ module FeatureCard = {
143144
<section
144145
className="flex sm:px-4 md:px-8 lg:px-0 flex-col justify-end lg:flex-row sm:items-center h-full">
145146
<div className="w-full h-full sm:self-start md:self-auto max-h-101.75">
146-
<Link to=Url(`/blog/${slug}`) className="relative block pt-2/3">
147-
{switch badge {
148-
| Some(badge) =>
149-
<div className="absolute z-10 top-0 mt-10 ml-4 lg:-ml-4">
150-
<Badge badge />
151-
</div>
152-
| None => React.null
153-
}}
154-
{
155-
let className = "absolute top-0 h-full w-full object-cover"
156-
switch previewImg {
157-
| Some(src) => <img className src />
158-
| None => <img className src=defaultPreviewImg loading={#eager} />
159-
}
160-
}
161-
</Link>
147+
// <Link to=Url(`/blog/${slug}`) className="relative block pt-2/3">
148+
// {switch badge {
149+
// | Some(badge) =>
150+
// <div className="absolute z-10 top-0 mt-10 ml-4 lg:-ml-4">
151+
// <Badge badge />
152+
// </div>
153+
// | None => React.null
154+
// }}
155+
// {
156+
// let className = "absolute top-0 h-full w-full object-cover"
157+
// switch previewImg {
158+
// | Some(src) => <img className src />
159+
// | None => <img className src=defaultPreviewImg loading={#eager} />
160+
// }
161+
// }
162+
// </Link>
162163
</div>
163164
<div
164165
className="relative px-4 lg:self-auto sm:pt-12 md:px-20 sm:self-start md:-mt-20 mt-4 bg-white lg:w-full lg:pt-0 lg:mt-0 lg:px-0 lg:ml-12">
@@ -192,9 +193,9 @@ module FeatureCard = {
192193
<p className="body-md text-gray-70"> {React.string(firstParagraph)} </p>
193194
</div>
194195
</div>
195-
<Link to=Url(`/blog/${slug}`)>
196-
<Button> {React.string("Read Article")} </Button>
197-
</Link>
196+
// <Link to=Url(`/blog/${slug}`)>
197+
// <Button> {React.string("Read Article")} </Button>
198+
// </Link>
198199
</div>
199200
</section>
200201
}

src/BlogArticle.res

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ let default = (props: props) => {
171171
<div className="text-24 sm:text-32 text-center text-gray-80 font-medium">
172172
{React.string("Want to read more?")}
173173
</div>
174-
<ReactRouter.Link
175-
to={("/blog" :> ReactRouter.Link.to)} className="text-fire hover:text-fire-70">
176-
{React.string("Back to Overview")}
177-
<Icon.ArrowRight className="ml-2 inline-block" />
178-
</ReactRouter.Link>
174+
// <ReactRouter.Link
175+
// to={("/blog" :> ReactRouter.Link.to)} className="text-fire hover:text-fire-70">
176+
// {React.string("Back to Overview")}
177+
// <Icon.ArrowRight className="ml-2 inline-block" />
178+
// </ReactRouter.Link>
179179
</div>
180180
</div>
181181
</div>

src/DocsOverview.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Card = {
66
<ul>
77
{Array.map(hrefs, ((text, href)) =>
88
<li key=text className="text-16 mb-1 last:mb-0">
9-
<ReactRouter.Link to=Url(href)> {React.string(text)} </ReactRouter.Link>
9+
<ReactRouter.Link.String to=href> {React.string(text)} </ReactRouter.Link.String>
1010
</li>
1111
)->React.array}
1212
</ul>

0 commit comments

Comments
 (0)