@@ -10,8 +10,8 @@ module MdxComp = {
10
10
`
11
11
)
12
12
13
- @bs. get
14
- external frontmatter : t => Js .Json .t = "frontmatter"
13
+ /* @bs.get */
14
+ /* external frontmatter: t => Js.Json.t = "frontmatter" */
15
15
}
16
16
17
17
@module ("misc_docs/syntax/decorator_module.mdx" )
@@ -106,6 +106,9 @@ let getAnchor = path => {
106
106
107
107
module SearchBox = {
108
108
@bs. send external focus : Dom .element => unit = "focus"
109
+ @bs. send external blur : Dom .element => unit = "blur"
110
+
111
+ external toDomElement : Js .t <'a > => Dom .element = "%identity"
109
112
110
113
type state =
111
114
| Active
@@ -129,8 +132,11 @@ module SearchBox = {
129
132
let focusInput = () =>
130
133
textInput .current -> Js .Nullable .toOption -> Belt .Option .forEach (el => el -> focus )
131
134
132
- let onAreaFocus = _evt => {
133
- if state === Inactive {
135
+ let onAreaFocus = evt => {
136
+ let el = ReactEvent .Focus .target (evt )
137
+ let isDiv = Js .Null_undefined .isNullable (el ["type" ])
138
+
139
+ if isDiv && state === Inactive {
134
140
focusInput ()
135
141
}
136
142
}
@@ -175,6 +181,7 @@ module SearchBox = {
175
181
<div
176
182
tabIndex = {- 1 }
177
183
onFocus = onAreaFocus
184
+ onBlur
178
185
className = {(
179
186
state === Active ? "border-fire" : "border-fire-40"
180
187
) ++ " flex items-center border rounded-lg py-4 px-5" }>
@@ -185,14 +192,13 @@ module SearchBox = {
185
192
value
186
193
ref = {ReactDOM .Ref .domRef (textInput )}
187
194
onFocus
188
- onBlur
189
195
onKeyDown
190
196
onChange = {onChange }
191
197
placeholder = "Enter keywords or syntax..."
192
198
className = "text-16 outline-none ml-4 w-full"
193
199
type_ = "text"
194
200
/>
195
- <button className = {value === "" ? "hidden" : "block" } onMouseDown = onMouseDownClear >
201
+ <button onFocus className = {value === "" ? "hidden" : "block" } onMouseDown = onMouseDownClear >
196
202
<Icon .Close className = "w-4 h-4 text-fire" />
197
203
</button >
198
204
</div >
@@ -218,7 +224,11 @@ module DetailBox = {
218
224
React .string (first ),
219
225
<span className = "text-fire" > {React .string (second )} </span >,
220
226
React .string (third ),
221
- ]-> React .array
227
+ ]
228
+ -> Belt .Array .mapWithIndex ((i , el ) => {
229
+ <span key = {Belt .Int .toString (i )}> el </span >
230
+ })
231
+ -> React .array
222
232
| more => Belt .Array .map (more , s => React .string (s ))-> React .array
223
233
}
224
234
@@ -347,8 +357,8 @@ let make = () => {
347
357
</span >
348
358
})
349
359
let el =
350
- <div className = "first:mt-0 mt-12" >
351
- <Category key = title title > {React .array (children )} </Category >
360
+ <div key = title className = "first:mt-0 mt-12" >
361
+ <Category title > {React .array (children )} </Category >
352
362
</div >
353
363
Js .Array2 .push (acc , el )-> ignore
354
364
acc
0 commit comments