-
Notifications
You must be signed in to change notification settings - Fork 226
/
search-input.blade.php
47 lines (42 loc) · 1.78 KB
/
search-input.blade.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<button
title="Start searching"
type="button"
class="flex md:hidden bg-gray-100 hover:bg-blue-100 justify-center items-center border border-gray rounded-full focus:outline-none h-10 px-3"
onclick="searchInput.toggle()"
>
<img src="/assets/img/magnifying-glass.svg" alt="search icon" class="h-4 w-4 max-w-none">
</button>
<div id="js-search-input" class="docsearch-input__wrapper hidden md:block">
<label for="search" class="hidden">Search</label>
<input
id="docsearch-input"
class="docsearch-input relative block h-10 transition-fast w-full lg:w-1/2 xl:w-1/3 bg-gray-100 outline-none rounded-full text-gray-700 border border-gray focus:border-blue-400 ml-auto px-4 pb-0"
name="docsearch"
type="text"
placeholder="Search"
>
<button
class="md:hidden absolute pin-t pin-r h-full font-light text-3xl text-blue hover:text-blue-600 focus:outline-none -mt-px pr-7"
onclick="searchInput.toggle()"
>×</button>
</div>
@push('scripts')
@if ($page->docsearchApiKey && $page->docsearchIndexName)
<script type="text/javascript">
docsearch({
apiKey: '{{ $page->docsearchApiKey }}',
indexName: '{{ $page->docsearchIndexName }}',
inputSelector: '#docsearch-input',
debug: false // Set debug to true if you want to inspect the dropdown
});
const searchInput = {
toggle() {
const menu = document.getElementById('js-search-input');
menu.classList.toggle('hidden');
menu.classList.toggle('md:block');
document.getElementById('docsearch-input').focus();
},
}
</script>
@endif
@endpush