Skip to content

Some react docs fixes #956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 28, 2024
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
1 change: 1 addition & 0 deletions src/common/Url.res
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ let parse = (route: string): t => {
let version = switch fullpath[foundVersionIndex] {
| Some(version) if version === Constants.versions.next => Next
| Some(version) if version === Constants.versions.latest => Latest
| Some("latest") => Latest // still used for React docs
| Some(v) => Version(v)
| None => NoVersion
}
Expand Down
5 changes: 3 additions & 2 deletions src/layouts/DocsLayout.res
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ let make = (
}, [])

let preludeSection =
<div className="flex justify-between text-fire font-medium items-baseline">
<div className="flex flex-col justify-between text-fire font-medium items-baseline">
{React.string(title)}
{switch version {
| Some(version) =>
Expand Down Expand Up @@ -178,6 +178,7 @@ module Make = (Content: StaticContent) => {
~frontmatter=?,
~version: option<string>=?,
~availableVersions: option<array<(string, string)>>=?,
~nextVersion: option<(string, string)>=?,
/* ~activeToc: option<SidebarLayout.Toc.t>=?, */
~components: option<MarkdownComponents.t>=?,
~theme: option<ColorTheme.t>=?,
Expand Down Expand Up @@ -239,7 +240,7 @@ module Make = (Content: StaticContent) => {
?frontmatter,
?version,
?availableVersions,
nextVersion: ?Constants.nextVersion,
?nextVersion,
?activeToc,
categories,
?components,
Expand Down
1 change: 1 addition & 0 deletions src/layouts/DocsLayout.resi
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ module Make: (Content: StaticContent) =>
~frontmatter: JSON.t=?,
~version: string=?,
~availableVersions: array<(string, string)>=?,
~nextVersion: (string, string)=?,
/* ~activeToc: option<SidebarLayout.Toc.t>=?, */
~components: MarkdownComponents.t=?,
~theme: ColorTheme.t=?,
Expand Down
5 changes: 5 additions & 0 deletions src/layouts/ManualDocsLayout.res
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ module V1200 = {
title
metaTitleCategory="ReScript Language Manual"
availableVersions=Constants.allManualVersions
nextVersion=?Constants.nextVersion
?frontmatter
breadcrumbs>
{version === Constants.versions.next ? warnBanner : React.null}
Expand Down Expand Up @@ -89,6 +90,7 @@ module V1100 = {
title
metaTitleCategory="ReScript Language Manual"
availableVersions=Constants.allManualVersions
nextVersion=?Constants.nextVersion
?frontmatter
breadcrumbs>
children
Expand Down Expand Up @@ -129,6 +131,7 @@ module V1000 = {
title
metaTitleCategory="ReScript Language Manual"
availableVersions=Constants.allManualVersions
nextVersion=?Constants.nextVersion
?frontmatter
breadcrumbs>
children
Expand Down Expand Up @@ -173,6 +176,7 @@ module V900 = {
title
metaTitleCategory="ReScript Language Manual"
availableVersions=Constants.allManualVersions
nextVersion=?Constants.nextVersion
?frontmatter
breadcrumbs>
children
Expand Down Expand Up @@ -248,6 +252,7 @@ module V800 = {
title
metaTitleCategory="ReScript Language Manual"
availableVersions=Constants.allManualVersions
nextVersion=?Constants.nextVersion
?frontmatter
breadcrumbs>
warnBanner
Expand Down
18 changes: 15 additions & 3 deletions src/layouts/ReactDocsLayout.res
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ module Latest = {
let router = Next.Router.useRouter()
let route = router.route
let url = route->Url.parse
let version = url->Url.getVersionString

let version = switch url.version {
| Version(version) => version
| _ => "latest"
}

let breadcrumbs = list{
{Url.name: "Docs", href: "/docs/latest"},
Expand Down Expand Up @@ -55,7 +59,11 @@ module V0110 = {
let router = Next.Router.useRouter()
let route = router.route
let url = route->Url.parse
let version = url->Url.getVersionString

let version = switch url.version {
| Version(version) => version
| _ => "latest"
}

let breadcrumbs = list{
{Url.name: "Docs", href: "/docs/latest"},
Expand Down Expand Up @@ -84,7 +92,11 @@ module V0100 = {
let router = Next.Router.useRouter()
let route = router.route
let url = route->Url.parse
let version = url->Url.getVersionString

let version = switch url.version {
| Version(version) => version
| _ => "latest"
}

let breadcrumbs = list{
{Url.name: "Docs", href: "/docs/latest"},
Expand Down
Loading