Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 14 additions & 18 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
data/api/**/*.json

!_shims.mjs
!public/_redirects
.DS_Store
*.swp
.next/
.react-router
*.swo
*.swp
app/**/*.mjs
build
data/api/**/*.json
dist
index_data/*.json
node_modules/
out/
public/playground-bundles/

# Generated via update-index script
public/blog/feed.xml

node_modules/
.next/
out/
index_data/*.json

# Generated via test examples script
_tempFile.cmi
Expand All @@ -19,6 +25,7 @@ _tempFile.cmt
_tempFile.res
temp


.bsb.lock
.merlin
lib/
Expand All @@ -34,16 +41,5 @@ public/llms/manual/**/llm*.txt
public/llms/react/**/llm*.txt
pages/docs/**/**/llms.mdx

public/playground-bundles/
!public/_redirects


dist
build
.react-router

app/**/*.mjs
!_shims.mjs

# prettier refuses to not mess up the installation table
markdown-pages/docs/manual/installation.mdx
10 changes: 3 additions & 7 deletions app/root.res
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,13 @@ let default = () => {
<html>
<head>
<style> {React.string("html {opacity:0;}")} </style>
<link rel="preload" href={mainCss} as_="css" />
// Preload the fonts used for the above the fold on the homepage
<link rel="preload" href="/fonts/subset-Inter-Bold.woff2" as_="font" />
<link rel="preload" href="/fonts/subset-Inter-Regular.woff2" as_="font" />
<link rel="preload" href={mainCss} as_="style" />
<link rel="stylesheet" href={mainCss} />

<Links />
<Meta />
<link rel="stylesheet" href={hljsCss} />
<link rel="stylesheet" href={utilsCss} />
<link rel="icon" href="/favicon.ico" />
<Links />
<Meta />
<meta
name="viewport"
content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, minimal-ui"
Expand Down
1 change: 1 addition & 0 deletions generate-route-types.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const paths = routes.map((route) => `#"/${route.path}"`).join(" |\n");
await fs.writeFile(
"src/Path.res",
`type t = [
#"/" |
${paths}
]
`,
Expand Down
20 changes: 13 additions & 7 deletions src/ApiDocs.res
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type item =

module RightSidebar = {
@react.component
let make = (~items: array<item>) => {
let make = (~items: array<item>, ~onClick) => {
items
->Array.map(item => {
switch item {
Expand All @@ -67,10 +67,11 @@ module RightSidebar = {
let title = `${Option.isSome(deprecatedIcon) ? "Deprecated " : ""}` ++ name
let result =
<li className="my-3" key={href}>
<a
<ReactRouter.Link.String
title
className="flex items-center w-full font-normal text-14 text-gray-40 leading-tight hover:text-gray-80"
href
to=href
onClick={_ => onClick()}
>
<div
className={`${bgColor} min-w-[20px] min-h-[20px] w-5 h-5 mr-3 flex justify-center items-center rounded-xl`}
Expand All @@ -84,7 +85,7 @@ module RightSidebar = {
| Some(icon) => icon
| None => React.null
}}
</a>
</ReactRouter.Link.String>
</li>
result
}
Expand Down Expand Up @@ -115,7 +116,7 @@ module SidebarTree = {
| true =>
<div className={"xl:hidden ml-5"} dataTestId={`submenu-${node.name}`}>
<ul className={"list-none py-0.5"}>
<RightSidebar items />
<RightSidebar items onClick=toggle />
</ul>
</div>
| false => React.null
Expand Down Expand Up @@ -286,9 +287,14 @@ module DocstringsStylize = {
}

let make = (props: props) => {
let (_, setScrollLock) = ScrollLockContext.useScrollLock()
let (isSidebarOpen, setSidebarOpen) = React.useState(_ => true)

let toggleSidebar = () => setSidebarOpen(prev => !prev)
let toggleSidebar = () =>
setSidebarOpen(prev => {
setScrollLock(_ => !prev)
!prev
})

let children = {
open Markdown
Expand Down Expand Up @@ -337,7 +343,7 @@ let make = (props: props) => {
{"Types and values"->React.string}
</div>
<ul>
<RightSidebar items />
<RightSidebar items onClick=toggleSidebar />
</ul>
</aside>
</div>
Expand Down
Loading