Skip to content

Commit 09e3e1c

Browse files
authored
Merge pull request #400 from coderdojo-japan/enable-algolia-docsearch
Enable DocSearch in Kata powered by Algolia
2 parents 6d3c097 + bee0c6c commit 09e3e1c

File tree

4 files changed

+74
-11
lines changed

4 files changed

+74
-11
lines changed

app/assets/stylesheets/clean-blog.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ hr.small {
8383
}
8484
.navbar-custom .nav li a {
8585
color: white;
86-
padding: 20px;
86+
padding: 20px 0px;
87+
padding-right: 20px;
88+
padding-left: 5px;
8789
}
8890
.navbar-custom .nav li a:hover,
8991
.navbar-custom .nav li a:focus {

app/assets/stylesheets/custom.scss

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,64 @@
11
@import "bootstrap-sprockets";
22
@import "bootstrap";
33

4-
// Customized by YassLab
4+
// Customized by YassLab team
55

6-
/*改行位置の調整*/
7-
.ignore-pc{
8-
display:none;
9-
}
10-
.ignore-sp{
11-
display:inline;
12-
}
6+
/* DocSearch by Algolia */
7+
.search {
8+
padding-top: 17px;
9+
padding-left: 15px;
10+
padding-right: 20px;
11+
padding-bottom: 10px;
12+
}
13+
#searchbox {
14+
padding-left: 5px;
15+
font-size: 90%;
16+
}
17+
.algolia-autocomplete {
18+
/* Main dropdown wrapper */
19+
// max-width: 100px;
20+
}
21+
.algolia-autocomplete .ds-dropdown-menu {
22+
// width: 200px;
23+
}
24+
.algolia-autocomplete .algolia-docsearch-suggestion--category-header {
25+
/* Main category (eg. Getting Started) */
26+
// color: darkgray;
27+
// border: 1px solid gray;
28+
}
29+
.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column {
30+
/* Category (eg. Downloads) */
31+
// color: gray;
32+
}
33+
.algolia-autocomplete .algolia-docsearch-suggestion--title {
34+
/* Title (eg. Bootstrap CDN) */
35+
// font-weight: bold;
36+
// color: black;
37+
}
38+
.algolia-autocomplete .algolia-docsearch-suggestion--text {
39+
/* Description description (eg. Bootstrap currently works...) */
40+
// font-size: 0.8rem;
41+
// color: gray;
42+
}
43+
.algolia-autocomplete .algolia-docsearch-suggestion--highlight {
44+
/* Highlighted text */
45+
// color: blue;
46+
}
47+
48+
/* 改行位置の調整 */
49+
.ignore-pc{
50+
displayplay:none;
51+
}
52+
.ignore-sp{
53+
display:inline;
54+
}
1355

1456
@media screen and (max-width: 640px) {
1557
.ignore-pc{
16-
display:inline;
58+
display:inline;
1759
}
1860
.ignore-sp{
19-
display:none;
61+
display:none;
2062
}
2163
}
2264

app/views/layouts/application.html.haml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,27 @@
5454
/[if lt IE 9]
5555
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
5656
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
57+
58+
/ at the end of the HEAD
59+
%link{:href => "https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css", :rel => "stylesheet"}/
60+
5761
%body
5862
- flash.each do |message_type, message|
5963
%div{:class => "alert alert-#{message_type}"}= message
6064
= yield
6165
= scrivito_body_tags if using_scrivito?
6266
= render 'shared/footer'
67+
/ at the end of the BODY
68+
%script{:src => "https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js",
69+
:type => "text/javascript"}
70+
:javascript
71+
docsearch({
72+
apiKey: '315da3c406c3fa374a0696590f4821a3',
73+
indexName: 'coderdojo',
74+
inputSelector: '#searchbox',
75+
debug: false // Set debug to true if you want to inspect the dropdown
76+
});
77+
6378
#fb-root
6479
:javascript
6580
(function(d, s, id) {

app/views/plain_page/index.html.haml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
/ Collect the nav links, forms, and other content for toggling
1414
#bs-example-navbar-collapse-1.collapse.navbar-collapse
1515
%ul.nav.navbar-nav.navbar-right
16+
%li.search
17+
%input#searchbox{ :placeholder => "🔍 検索", :type => "text" }
18+
#hits
19+
#pagination
1620
%li
1721
%a{:href => "#README"} はじめに
1822
%li

0 commit comments

Comments
 (0)