Skip to content

Commit 756aa5f

Browse files
committed
Codetab, layout, further color refinements
1 parent 76e7c5e commit 756aa5f

19 files changed

+106
-109
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"@mdx-js/loader": "^1.5.5",
1313
"@next/mdx": "^8.1.0",
1414
"@octokit/graphql-schema": "^7.4.0",
15+
"@rescript/react": "^0.10.1",
1516
"@ryyppy/rescript-promise": "^0.0.2",
1617
"@zeit/next-css": "^1.0.1",
1718
"bs-fetch": "^0.3.1",
@@ -29,7 +30,6 @@
2930
"prettier": "^1.18.2",
3031
"react": "^16.12.0",
3132
"react-dom": "^16.12.0",
32-
"@rescript/react": "^0.10.1",
3333
"remark-parse": "^7.0.1",
3434
"remark-slug": "^5.1.2",
3535
"remark-stringify": "^7.0.3",

src/Playground.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Playground.res

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ module Statusbar = {
219219
if Array.length(warnings) === 0 {
220220
"bg-turtle-dark"
221221
} else {
222-
"bg-orange-dark"
222+
"bg-orange"
223223
}
224224
}
225225

@@ -243,7 +243,7 @@ module ResultPane = {
243243
let compactErrorLine = (~highlight=false, ~prefix: prefix, locMsg: Api.LocMsg.t) => {
244244
let {Api.LocMsg.row: row, column, shortMsg} = locMsg
245245
let prefixColor = switch prefix {
246-
| #W => "text-orange-dark"
246+
| #W => "text-orange"
247247
| #E => "text-fire"
248248
}
249249

@@ -255,7 +255,7 @@ module ResultPane = {
255255
let highlightClass = switch (highlight, prefix) {
256256
| (false, _) => ""
257257
| (true, #W) => "bg-orange-15"
258-
| (true, #E) => "bg-fire-10 rounded"
258+
| (true, #E) => "bg-fire-90 rounded"
259259
}
260260

261261
<div className="font-mono mb-4 pb-6 last:mb-0 last:pb-0 last:border-0 border-b border-gray-80 ">
@@ -450,7 +450,7 @@ module ResultPane = {
450450

451451
let renderTitle = result => {
452452
let errClass = "text-fire"
453-
let warnClass = "text-orange-dark"
453+
let warnClass = "text-orange"
454454
let okClass = "text-turtle-dark"
455455

456456
let (className, text) = switch result {

src/components/ApiMarkdown.js

Lines changed: 2 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/ApiMarkdown.res

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
open Markdown
2-
2+
/*
33
module H1 = {
44
@react.component
55
let make = (~children) =>
66
<h1 className="text-42 tracking-tight leading-1 mb-2 font-sans font-medium text-gray-95"> children </h1>
7-
}
7+
}*/
88

99
module H2 = {
1010
// We will currently hide the headline, to keep the structure,
1111
// but having an Elm like documentation
1212
@react.component
1313
let make = (~id, ~children) => <>
14-
<div className="border-b border-gray-10 mb-10 mt-20" /> <Markdown.H2 id> children </Markdown.H2>
14+
<div className="mb-10 mt-20" /> <Markdown.H2 id> children </Markdown.H2>
1515
</>
1616
}
1717

18+
1819
let default = Mdx.Components.t(
1920
~intro=Intro.make,
2021
~p=P.make,

src/components/CodeExample.js

Lines changed: 26 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/CodeExample.res

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ let make = (~highlightedLines=[], ~code: string, ~showLabel=true, ~lang="text")
1414

1515
let label = if showLabel {
1616
let label = langShortname(lang)
17-
<div className="flex self-end font-sans mb-4 text-12 font-bold text-gray-60 px-4">
17+
<div className="absolute right-0 px-4 pb-4 bg-gray-5 font-sans text-12 font-bold text-gray-60 ">
1818
{//RES or JS Label
1919
Js.String2.toUpperCase(label)->React.string}
2020
</div>
2121
} else {
22-
<div className="mt-4" />
22+
React.null
2323
}
2424

2525
<div //normal code-text without tabs
26-
className="flex w-full flex-col rounded-none xs:rounded border-t border-b xs:border border-gray-10 bg-gray-5 py-2 text-gray-90">
27-
label <div className="px-4 text-14 pb-2 overflow-x-auto -mt-2"> children </div>
26+
className="relative w-full flex-col rounded-none xs:rounded border-t border-b xs:border border-gray-10 bg-gray-5 py-2 text-gray-90">
27+
label <div className="px-4 text-14 pt-4 pb-2 overflow-x-auto -mt-2"> children </div>
2828
</div>
2929
}
3030

@@ -62,9 +62,9 @@ module Toggle = {
6262
}
6363

6464
let activeClass = if selected === i {
65-
"font-semibold text-gray-90 bg-gray-5 border border-b-0 border-gray-10"
65+
"font-medium text-gray-90 bg-gray-5 border-t-2 border-l border-r"
6666
} else {
67-
"border-gray-10 border-b bg-gray-10 hover:cursor-pointer"
67+
"font-medium hover:text-gray-60 border-t-2 border-gray-20 bg-gray-10 hover:cursor-pointer"
6868
}
6969

7070
let onClick = evt => {
@@ -75,14 +75,22 @@ module Toggle = {
7575

7676
let paddingX = switch numberOfItems {
7777
| 1
78-
| 2 => "sm:px-16"
78+
| 2 => "sm:px-4"
7979
| 3 => "lg:px-8"
8080
| _ => ""
8181
}
82+
83+
let style = if selected === i {
84+
ReactDOM.Style.make(~borderColor="#f4646a #EDF0F2", ())->Some
85+
} else {
86+
None
87+
}
88+
8289
<span
8390
key
91+
?style
8492
className={paddingX ++
85-
(" flex-none px-4 inline-block p-2 rounded-tl rounded-tr " ++
93+
(" flex-none px-4 first:ml-6 xs:first:ml-0 inline-block p-1 rounded-tl rounded-tr " ++
8694
activeClass)}
8795
onClick>
8896
{React.string(label)}
@@ -97,14 +105,14 @@ module Toggle = {
97105
})
98106
->Belt.Option.getWithDefault(React.null)
99107

100-
<div className="flex w-full flex-col rounded-none text-gray-80">
108+
<div className="relative pt-6 w-full rounded-none text-gray-80"> //text within code-box
101109
<div
102-
className="flex w-full overflow-auto scrolling-touch font-sans bg-transparent text-sm text-gray-60-tr">
103-
<div className="flex"> {React.array(tabElements)} </div>
110+
className="absolute flex w-full overflow-auto scrolling-touch font-sans bg-transparent text-14 text-gray-40 " style={ReactDOM.Style.make(~marginTop="-30px", ())}>
111+
<div className="flex space-x-2" > {React.array(tabElements)} </div>
104112
<div className="flex-1 border-b border-gray-10"> {React.string(j`\\u00A0`)} </div>
105113
</div>
106114
<div
107-
className="px-4 text-14 pb-4 pt-4 overflow-x-auto bg-gray-5 border-gray-10 xs:rounded-b border border-t-0">
115+
className="px-4 text-14 pb-4 pt-4 overflow-x-auto bg-gray-5 border-gray-10 xs:rounded-b border border-t-1">
108116
<pre> children </pre>
109117
</div>
110118
</div>

src/components/CodeMirror.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/CodeMirror.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ module GutterMarker = {
218218
let marker = createElement("div")
219219
let colorClass = switch kind {
220220
| #Warning => "text-orange bg-orange-15"
221-
| #Error => "text-fire bg-fire-10"
221+
| #Error => "text-fire bg-fire-100"
222222
}
223223

224224
let (row, col) = rowCol

0 commit comments

Comments
 (0)