Skip to content

Commit 77afb4b

Browse files
committed
Website: add search
1 parent 32c26fe commit 77afb4b

4 files changed

Lines changed: 57 additions & 8 deletions

File tree

‎website/scripts/Prerender.re‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,17 @@ let make =
4343
{j|
4444
<!DOCTYPE html>
4545
<html style="height:100%">
46-
<head>$helmetMeta $helmetLinks $helmetTitle $helmetStyle $helmetScript $css</head>
47-
<body style="min-height:100%">$html</body>
46+
<head>
47+
$helmetMeta
48+
$helmetLinks
49+
$helmetTitle
50+
$helmetStyle
51+
$css
52+
</head>
53+
<body style="min-height:100%">
54+
$html
55+
$helmetScript
56+
</body>
4857
</html>|j};
4958
};
5059

‎website/src/components/Head.re‎

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,11 @@ code {
8080
font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;
8181
}
8282
83-
h1, h2, h3, h4, h5, h6 {
84-
all: unset;
83+
/* we use this tags for semantics/indexing only */
84+
h1, h2, h3, h4, h5, h6, p, blockquote {
85+
font:inherit;
86+
margin: 0;
87+
padding: 0;
8588
}
8689
8790
.hljs {
@@ -105,4 +108,23 @@ h1, h2, h3, h4, h5, h6 {
105108
|j}
106109
->React.string
107110
</style>
111+
// algolia
112+
<link
113+
rel="stylesheet"
114+
href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css"
115+
/>
116+
<script
117+
src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"
118+
/>
119+
<script>
120+
{j|
121+
docsearch({
122+
"apiKey": "2e8d1544f0698bef1243f3f7850b6483",
123+
"indexName": "reason-react-native",
124+
"inputSelector": "#SearchInput",
125+
"debug": true
126+
});
127+
|j}
128+
->React.string
129+
</script>
108130
</BsReactHelmet>;

‎website/src/components/HeaderLarge.re‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@ let styles =
1717
~zIndex=1,
1818
(),
1919
),
20+
"barWrapper":
21+
style(~backgroundColor=Consts.Colors.dark, ~overflow=`visible, ())
22+
->unsafeAddStyle({"overflow-y": "visible", "overflow-x": "hidden"}),
2023
"bar":
2124
style(
2225
~flexDirection=`row,
2326
~flexWrap=`wrap,
2427
~justifyContent=`spaceBetween,
2528
(),
2629
),
27-
"barWrapper": style(~backgroundColor=Consts.Colors.dark, ()),
30+
2831
"logoLink":
2932
style(
3033
~flexGrow=1.,
@@ -42,6 +45,7 @@ let styles =
4245
~color=Consts.Colors.light,
4346
(),
4447
),
48+
"search": style(),
4549
"links":
4650
style(
4751
~flexGrow=1.,
@@ -129,6 +133,20 @@ let make = (~currentLocation) => {
129133
})
130134
->React.array}
131135
</SpacedView>
136+
<SpacedView style=styles##search vertical=XS>
137+
<input
138+
id="SearchInput"
139+
placeholder="Search"
140+
style={ReactDOMRe.Style.make(
141+
~fontSize="15px",
142+
~width="120px",
143+
~borderRadius="20px",
144+
~border="0",
145+
~padding="10px 20px",
146+
(),
147+
)}
148+
/>
149+
</SpacedView>
132150
<SpacedView style=styles##icons vertical=XS>
133151
{Consts.socialLinks
134152
->Belt.Array.map(item =>

‎website/src/components/shared/Html.re‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ module P = {
234234
) => {
235235
<View style=Style.(arrayOption([|Some(styles##p), styl|]))>
236236
<Text style=Style.(arrayOption([|Some(styles##text), textStyl|]))>
237-
children
237+
<p> children </p>
238238
</Text>
239239
</View>;
240240
};
@@ -270,7 +270,7 @@ module Li = {
270270
style=Style.(
271271
arrayOption([|Some(styles##li), Some(styles##text), styl|])
272272
)>
273-
children
273+
<p> children </p>
274274
</Text>
275275
</View>;
276276
};
@@ -288,7 +288,7 @@ module BlockQuote = {
288288
<View style=Style.(arrayOption([|Some(styles##blockQuote), styl|]))>
289289
<Text
290290
style=Style.(arrayOption([|Some(styles##blockQuoteText), textStyl|]))>
291-
children
291+
<blockquote> children </blockquote>
292292
</Text>
293293
</View>;
294294
};

0 commit comments

Comments
 (0)