Skip to content

Commit

Permalink
Unify version select labels between docs and playground
Browse files Browse the repository at this point in the history
  • Loading branch information
fhammerschmidt committed Dec 27, 2024
1 parent 52b886f commit 93e52c1
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"unified": "^8.4.0"
},
"scripts": {
"dev": "NODE_OPTIONS='--inspect' next dev",
"dev": "next",
"build": "rescript && npm run update-index && next build",
"test": "node scripts/test-examples.mjs && node scripts/test-hrefs.mjs",
"reanalyze": "reanalyze -all-cmt .",
Expand Down
8 changes: 2 additions & 6 deletions src/Playground.res
Original file line number Diff line number Diff line change
Expand Up @@ -969,9 +969,7 @@ module Settings = {
cmp(b) - cmp(a)
})
<>
<option disabled=true className="py-4">
{React.string("--- Experimental ---")}
</option>
<VersionSelect.SectionHeader value=Constants.dropdownLabelNext />
{versionByOrder
->Array.map(version => {
let version = Semver.toString(version)
Expand All @@ -980,9 +978,7 @@ module Settings = {
</option>
})
->React.array}
<option disabled=true className="py-4">
{React.string("--- Official Releases ---")}
</option>
<VersionSelect.SectionHeader value=Constants.dropdownLabelReleased />
</>
}}
{switch stableVersions {
Expand Down
3 changes: 3 additions & 0 deletions src/common/Constants.res
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ let nextVersion =

let allReactVersions = [("latest", "v0.12.0"), ("v0.11.0", "v0.11.0"), ("v0.10.0", "v0.10.0")]

let dropdownLabelNext = "--- Next ---"
let dropdownLabelReleased = "--- Released ---"

// Used for the DocsOverview and collapsible navigation
let languageManual = version => {
[
Expand Down
14 changes: 8 additions & 6 deletions src/components/VersionSelect.res
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
module SectionHeader = {
@react.component
let make = (~value) =>
<option disabled=true key=value className="py-4"> {React.string(value)} </option>
}

@react.component
let make = (
~onChange,
Expand All @@ -18,13 +24,9 @@ let make = (
| None => React.null
| Some((value, label)) =>
<>
<option disabled=true key="next-heading" className="py-4">
{React.string("--- Next ---")}
</option>
<SectionHeader value=Constants.dropdownLabelNext />
<option className="py-4" key=value value> {React.string(label)} </option>
<option disabled=true key="released-heading" className="py-4">
{React.string("--- Released ---")}
</option>
<SectionHeader value=Constants.dropdownLabelReleased />
</>
}}
{React.array(children)}
Expand Down
5 changes: 5 additions & 0 deletions src/components/VersionSelect.resi
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
module SectionHeader: {
@react.component
let make: (~value: string) => React.element
}

@react.component
let make: (
~onChange: ReactEvent.Form.t => unit,
Expand Down

0 comments on commit 93e52c1

Please sign in to comment.