-
-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
150 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Docs: { | ||
@react.component | ||
let make: (~components: Mdx.Components.t=?, ~children: React.element) => React.element | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// Structure defined by `scripts/extract-indices.js` | ||
@module("index_data/v900_dom_api_index.json") | ||
external indexData: Js.Dict.t<{ | ||
"moduleName": string, | ||
"headers": array<{ | ||
"name": string, | ||
"href": string, | ||
}>, | ||
}> = "default" | ||
|
||
module Category = SidebarLayout.Sidebar.Category | ||
module NavItem = SidebarLayout.Sidebar.NavItem | ||
|
||
let overviewNavs = [ | ||
{ | ||
open NavItem | ||
{name: "Dom", href: "/docs/manual/v9.0.0/api/dom"} | ||
}, | ||
] | ||
|
||
let moduleNavs = [ | ||
{ | ||
open NavItem | ||
{name: "Storage", href: "/docs/manual/v9.0.0/api/dom/storage"} | ||
}, | ||
{ | ||
open NavItem | ||
{name: "Storage2", href: "/docs/manual/v9.0.0/api/dom/storage2"} | ||
}, | ||
] | ||
|
||
let categories = [ | ||
{ | ||
open Category | ||
{name: "Overview", items: overviewNavs} | ||
}, | ||
{name: "Submodules", items: moduleNavs}, | ||
] | ||
|
||
module Docs = { | ||
@react.component | ||
let make = (~components=ApiMarkdown.default, ~children) => { | ||
let router = Next.Router.useRouter() | ||
let route = router.route | ||
|
||
// Gather data for the CollapsibleSection | ||
let headers = { | ||
open Belt.Option | ||
Js.Dict.get(indexData, route) | ||
->map(data => | ||
data["headers"]->Belt.Array.map(header => (header["name"], "#" ++ header["href"])) | ||
) | ||
->getWithDefault([]) | ||
} | ||
|
||
let moduleName = { | ||
open Belt.Option | ||
Js.Dict.get(indexData, route)->map(data => data["moduleName"])->getWithDefault("?") | ||
} | ||
|
||
let url = route->Url.parse | ||
|
||
let version = switch url.version { | ||
| Version(version) => version | ||
| NoVersion => "latest" | ||
| Latest => "latest" | ||
} | ||
|
||
let prefix = { | ||
open Url | ||
{name: "API", href: "/docs/manual/" ++ (version ++ "/api")} | ||
} | ||
|
||
let breadcrumbs = ApiLayout.makeBreadcrumbs(~prefix, route) | ||
|
||
let activeToc = { | ||
open SidebarLayout.Toc | ||
{ | ||
title: moduleName, | ||
entries: Belt.Array.map(headers, ((name, href)) => {header: name, href}), | ||
} | ||
} | ||
|
||
let title = "Dom Module" | ||
let version = "v9.0.0" | ||
|
||
let warnBanner = <ApiLayout.OldDocsWarning route version /> | ||
|
||
<ApiLayout components title version activeToc categories breadcrumbs> | ||
warnBanner | ||
children | ||
</ApiLayout> | ||
} | ||
} | ||
|
||
module Prose = { | ||
@react.component | ||
let make = (~children) => <Docs components=ApiMarkdown.default> children </Docs> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module Docs: { | ||
@react.component | ||
let make: (~components: Mdx.Components.t=?, ~children: React.element) => React.element | ||
} | ||
module Prose: { | ||
@react.component | ||
let make: (~children: React.element) => React.element | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters