Skip to content

Commit fed8c2c

Browse files
committed
Add Algolia docsearch to site.
1 parent 1b755c5 commit fed8c2c

File tree

5 files changed

+86
-2
lines changed

5 files changed

+86
-2
lines changed

site/jekyll/Gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ gem 'bourbon', '~>3'
66

77
# For markdown header cleanup
88
gem 'sanitize'
9+
10+
gem 'wdm', '~> 0.1.0' if Gem.win_platform?

site/jekyll/Gemfile.lock

+6-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ GEM
1212
highline (~> 1.6.11)
1313
crass (1.0.2)
1414
fast-stemmer (1.0.2)
15-
ffi (1.9.17-x64-mingw32)
15+
ffi (1.9.18)
16+
ffi (1.9.18-x64-mingw32)
1617
highline (1.6.21)
1718
hike (1.2.3)
1819
jekyll (1.5.1)
@@ -40,7 +41,9 @@ GEM
4041
maruku (0.7.0)
4142
mini_portile2 (2.1.0)
4243
multi_json (1.12.1)
43-
nokogiri (1.7.0.1-x64-mingw32)
44+
nokogiri (1.7.1)
45+
mini_portile2 (~> 2.1.0)
46+
nokogiri (1.7.1-x64-mingw32)
4447
mini_portile2 (~> 2.1.0)
4548
nokogumbo (1.4.10)
4649
nokogiri
@@ -80,6 +83,7 @@ GEM
8083
yajl-ruby (1.1.0)
8184

8285
PLATFORMS
86+
ruby
8387
x64-mingw32
8488

8589
DEPENDENCIES

site/jekyll/_assets/stylesheets/react.scss

+65
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,28 @@ $columnGutter: 40px;
1717
$twoColumnWidth: 2 * $columnWidth + $columnGutter;
1818
$navHeight: 50px;
1919

20+
// Breakpoints
21+
$bp-large: 960px;
22+
$bp-medium: 640px;
23+
$bp-small: 480px;
2024

25+
@mixin bp-small {
26+
@media (max-width: $bp-small) {
27+
@content;
28+
}
29+
}
30+
31+
@mixin bp-medium {
32+
@media (max-width: $bp-medium) {
33+
@content;
34+
}
35+
}
36+
37+
@mixin bp-large {
38+
@media (max-width: $bp-large) {
39+
@content;
40+
}
41+
}
2142

2243
// basic reset
2344
* {
@@ -764,3 +785,47 @@ div[data-twttr-id] iframe {
764785
.three-column > ul:first-child {
765786
margin-left: 20px;
766787
}
788+
789+
/* Algolia Doc Search */
790+
791+
input#algolia-doc-search {
792+
background: transparent url('../img/search.png') no-repeat 10px center;
793+
background-size: 16px 16px;
794+
795+
position: relative;
796+
vertical-align: top;
797+
margin-left: 10px;
798+
padding: 0 10px;
799+
padding-left: 35px;
800+
height: 30px;
801+
margin-top: 10px;
802+
font-size: 16px;
803+
line-height: 20px;
804+
background-color: #333;
805+
border-radius: 4px;
806+
color: white;
807+
outline: none;
808+
width: 170px;
809+
810+
transition: width .2s ease;
811+
812+
&:focus {
813+
width: 240px;
814+
}
815+
816+
@include bp-large {
817+
background-color: transparent;
818+
width: 0;
819+
cursor: pointer;
820+
821+
&:focus {
822+
width: 200px;
823+
background-color: #333;
824+
}
825+
}
826+
}
827+
828+
.algolia-autocomplete {
829+
vertical-align: top;
830+
height: 53px;
831+
}

site/jekyll/_layouts/default.html

+13
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<link rel="alternate" type="application/rss+xml" title="{{ site.name }}" href="{{ site.url }}/feed.xml" />
1818

1919
{% stylesheet main %}
20+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.css" />
2021

2122
<script type="text/javascript" src="//use.typekit.net/vqa1hcx.js"></script>
2223
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
@@ -41,6 +42,7 @@
4142
<img class="nav-logo" src="/img/logo.svg" width="48" height="36">
4243
{{ site.name }}
4344
</a>
45+
<input id="algolia-doc-search" type="text" placeholder="Search docs..." />
4446
<ul class="nav-site">
4547
<li><a href="/docs"{% if page.sectionid == 'docs' and page.id != 'tutorial' and page.id != 'download' %} class="active"{% endif %}>Docs</a></li>
4648
<li><a href="/getting-started/tutorial.html"{% if page.id == 'tutorial' %} class="active"{% endif %}>Tutorial</a></li>
@@ -63,6 +65,17 @@
6365
</footer>
6466
</div>
6567

68+
<!-- Algolia search -->
69+
<script src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script>
70+
<script>
71+
docsearch({
72+
apiKey: 'e9888f8a8af8c16709c02402b15c7695',
73+
indexName: 'reactjs_net',
74+
inputSelector: '#algolia-doc-search',
75+
debug: false // Set debug to true if you want to inspect the dropdown
76+
});
77+
</script>
78+
6679
<!-- Facebook SDK -->
6780
<div id="fb-root"></div>
6881
<script>(function(d, s, id) {

site/jekyll/img/search.png

1.35 KB
Loading

0 commit comments

Comments
 (0)