Skip to content

Commit 2725604

Browse files
committed
see results
1 parent b733b01 commit 2725604

File tree

4 files changed

+139
-13
lines changed

4 files changed

+139
-13
lines changed

docs/css/search.css

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
.md-header .md-search .algolia-autocomplete .ds-dataset-1 {
2+
padding: 0;
3+
}
4+
5+
.md-header .md-search .algolia-autocomplete .algolia-docsearch-suggestion {
6+
padding: 0;
7+
}
8+
9+
.md-header .md-search .algolia-autocomplete .ds-dropdown-menu .ds-suggestion.ds-cursor .algolia-docsearch-suggestion:not(.suggestion-layout-simple) .algolia-docsearch-suggestion--content {
10+
background-color: transparent;
11+
color: var(--ibexa-jazzberry);
12+
}
13+
14+
.md-header .md-search .algolia-autocomplete .ds-dropdown-menu .ds-suggestion.ds-cursor .algolia-docsearch-suggestion:not(.suggestion-layout-simple) .algolia-docsearch-suggestion--wrapper * {
15+
color: var(--ibexa-jazzberry);
16+
}
17+
18+
.md-header .md-search .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--highlight {
19+
background-color: #ECF4FF;
20+
color: #4191FF !important;
21+
box-shadow: none;
22+
padding: 0;
23+
}
24+
25+
.md-header .md-search .algolia-autocomplete .algolia-docsearch-suggestion.algolia-docsearch-suggestion__main .algolia-docsearch-suggestion--category-header {
26+
display: flex;
27+
align-items: center;
28+
font-size: 14px;
29+
line-height: 21px;
30+
letter-spacing: 0.12px;
31+
height: 40px;
32+
margin: 16px 0 0 0;
33+
padding: 0 40px;
34+
border: 0;
35+
background-color: #F2F2F5;
36+
color: var(--ibexa-dusk-black);
37+
font-weight: 600;
38+
}
39+
40+
.md-header .md-search .algolia-autocomplete .ds-suggestions > .ds-suggestion:first-child .algolia-docsearch-suggestion.algolia-docsearch-suggestion__main .algolia-docsearch-suggestion--category-header {
41+
margin-top: 0;
42+
}
43+
44+
.md-header .md-search .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--wrapper {
45+
padding: 0;
46+
}
47+
48+
.md-header .md-search .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column {
49+
float: none;
50+
width: 100%;
51+
text-align: left;
52+
font-size: 18px;
53+
line-height: 20px;
54+
letter-spacing: 0.12px;
55+
margin: 24px 40px 4px;
56+
padding: 0;
57+
color: var(--ibexa-dusk-black);
58+
font-weight: 600;
59+
}
60+
61+
.md-header .md-search .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--content {
62+
float: none;
63+
width: 100%;
64+
text-align: left;
65+
color: #3B424A;
66+
font-size: 14px;
67+
line-height: 21px;
68+
letter-spacing: 0.12px;
69+
padding: 0;
70+
margin: 0 40px;
71+
display: flex;
72+
flex-direction: column-reverse;
73+
}
74+
75+
.md-header .md-search .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--content::before {
76+
display: none;
77+
}
78+
79+
.md-header .md-search .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--title {
80+
font-size: 12px;
81+
line-height: 21px;
82+
letter-spacing: 0.12px;
83+
margin-top: 16px;
84+
font-weight: 500;
85+
}
86+
87+
.md-header .md-search .algolia-autocomplete .algolia-docsearch-suggestion .aa-suggestion-title-separator {
88+
margin: 0 12px;
89+
font-weight: 500;
90+
}
91+
92+
.md-header .md-search .algolia-autocomplete .ds-dataset-1 {
93+
z-index: 1;
94+
padding-bottom: 70px;
95+
}
96+
97+
.md-header .md-search .algolia-autocomplete .search-page-link-wrapper {
98+
position: absolute;
99+
z-index: 2;
100+
bottom: 0;
101+
left: 0;
102+
right: 0;
103+
background-color: #F2F2F5;
104+
width: 100%;
105+
height: 60px;
106+
padding: 0 40px;
107+
display: flex;
108+
align-items: center;
109+
justify-content: center;
110+
}
111+
112+
.md-header .md-search .algolia-autocomplete .search-page-link {
113+
color: var(--link);
114+
transition: color 125ms;
115+
}
116+
117+
.md-header .md-search .algolia-autocomplete .search-page-link:hover {
118+
color: var(--ibexa-jazzberry);
119+
transition: color 125ms;
120+
}

docs/js/custom.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ $(document).ready(function() {
8686
indexName: 'ezplatform',
8787
inputSelector: '#search_input',
8888
transformData: function(hits) {
89-
let removedPattern = '¶';
89+
const hitsPerPage = 10;
90+
const removedPattern = '¶';
9091
$.each(hits, function(index, hit) {
9192
for (let lvl=2; lvl<=6; lvl++) {
9293
if (null !== hit.hierarchy['lvl'+lvl]) {
@@ -97,13 +98,19 @@ $(document).ready(function() {
9798
}
9899
}
99100
});
101+
100102
let link = $('.ds-dropdown-menu a.search-page-link');
103+
const href = '/en/' + branchName + '/search_results/#q=' + encodeURI($('#search_input').val()) + '&p=1';
104+
101105
if (!link.length) {
102-
link = $('.ds-dropdown-menu').append('<a class="search-page-link" href="" style="position: absolute; bottom: 0px; z-index: 1000;">See all results</a>');
106+
link = $('.ds-dropdown-menu').append(`<div class="search-page-link-wrapper">
107+
<a class="search-page-link" href="">See all results</a>
108+
</div>`);
103109
}
104-
let href = '/en/' + branchName + '/search_results/#q=' + encodeURI($(/*this.inputSelector*/'#search_input').val()) + '&p=1';
110+
105111
link.attr('href', href).show();
106-
if (hits.length < 10/*hitsPerPage*/) {
112+
113+
if (hits.length < hitsPerPage) {
107114
link.hide();
108115
}
109116
},

docs/js/instantsearch.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
},
2727
}
2828
}
29-
const search_query = document.location.hash.match(/q=(.*?)(&|$)/)[1] ?? '';
29+
const search_query = doc.location.hash.match(/q=(.*?)(&|$)/)[1] ?? '';
3030
const parsed_search_query = decodeURI(search_query.replace('+', ' '));
31-
const search_page = document.location.hash.match(/p=(\d*?)(&|$)/)[1] ?? 1;
31+
const search_page = doc.location.hash.match(/p=(\d*?)(&|$)/)[1] ?? 1;
3232
const parsed_search_page = parseInt(search_page);
33-
const version = document.location.pathname.split('/')[2];
33+
const version = doc.location.pathname.split('/')[2];
3434
const search = instantsearch({
3535
indexName: 'ezplatform',
3636
searchClient: algoliasearch('2DNYOU6YJZ', '21ce3e522455e18e7ee16cf7d66edb4b'),
@@ -43,12 +43,12 @@
4343
},
4444
});
4545

46-
document.getElementById('searchbox').addEventListener('keyup', function (event) {
46+
doc.getElementById('searchbox').addEventListener('keyup', function (event) {
4747
window.location.hash = '#q=' + encodeURI(event.target.value) + '&p=1';
4848
})
4949

50-
document.getElementById('pagination').addEventListener('click', function (event) {
51-
let page = document.getElementsByClassName('ais-Pagination-item--selected').length ? parseInt(document.getElementsByClassName('ais-Pagination-item--selected')[0].innerText) : 1
50+
doc.getElementById('pagination').addEventListener('click', function (event) {
51+
let page = doc.getElementsByClassName('ais-Pagination-item--selected').length ? parseInt(doc.getElementsByClassName('ais-Pagination-item--selected')[0].innerText) : 1
5252
window.location.hash = window.location.hash.includes('p=') ? window.location.hash.replace(/p=\d*/, 'p=' + page) : window.location.hash + '&p=' + page;
5353
})
5454

@@ -102,8 +102,6 @@
102102
</h2>`;
103103
let groupContentHTML = '';
104104

105-
console.log(children);
106-
107105
children.forEach((childHit) => {
108106
const { breadcrumbsKeys, entryNameKey, item: entryItem } = childHit;
109107
const headerHTML = `<h3 class="instantsearch__entry-header">
@@ -163,7 +161,7 @@
163161
},
164162
}),
165163
instantsearch.widgets.refinementList({
166-
container: document.querySelector('#version'),
164+
container: doc.querySelector('#version'),
167165
attribute: 'version',
168166
}),
169167
]);

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,7 @@ extra_css:
647647
- css/custom.css
648648
- css/page-not-found.css
649649
- css/navigation.css
650+
- css/search.css
650651
- css/docs.switcher.css
651652
- css/jquery-ui.min.css
652653
- '//cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css'

0 commit comments

Comments
 (0)