-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
115 lines (103 loc) · 4.96 KB
/
demo.html
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Searchbox DEMO - Fast, backend-less search to any website.</title>
<style>
/* Demo page styling */
html {
font-family: sans-serif;
}
a {
color: blue;
}
#search {
margin: 4rem auto;
max-width: 25rem;
}
.search-input {
align-items: center;
border: 1px solid gray;
border-radius: 5px;
display: flex;
padding: 0.2rem 0.4rem;
}
.search-input .search-box {
width: 100%;
}
.search-input > *:not(:last-child) {
margin-right: 5px;
}
.search-input input {
border: 0;
font-size: 100%;
outline: 0;
margin: 0;
padding: 0.5rem;
width: 100%;
}
.search-info {
margin: 0.5rem auto;
max-width: 25rem;
font-size: 80%;
}
.usage {
max-width: 32rem;
margin: 0 auto;
}
.usage pre code {
overflow: auto;
}
.footer {
font-size: 11px;
text-align: right;
}
/* Searchbox customization */
.searchbox-dropdown {
border-radius: 5px;
box-shadow: 3px 2px 4px rgba(0, 0, 0, 0.075);
}
</style>
</head>
<body>
<div id="search">
<div class="search-input">
<div>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M18.031 16.617l4.283 4.282-1.415 1.415-4.282-4.283A8.96 8.96 0 0 1 11 20c-4.968 0-9-4.032-9-9s4.032-9 9-9 9 4.032 9 9a8.96 8.96 0 0 1-1.969 5.617zm-2.006-.742A6.977 6.977 0 0 0 18 11c0-3.868-3.133-7-7-7-3.868 0-7 3.132-7 7 0 3.867 3.132 7 7 7a6.977 6.977 0 0 0 4.875-1.975l.15-.15z"/></svg>
</div>
<search-box
id="searchbox"
anchor="#search .search-input"
category="section"
groupBy="title"
class="search-box"
pagefind="https://pagefind.app/_pagefind/pagefind.js"
>
<input type="search" placeholder="Try demo..." />
</search-box>
</div>
<div class="search-info">
Try: <u>pagefind</u>, <u>search</u>, <u>indexing</u>, <u>multilingual</u>
</div>
</div>
<div class="usage">
<p><a href="https://github.com/ovx/searchbox">Searchbox</a> is a UI component built on top of <a href="https://pagefind.app/">Pagefind</a> providing fast, backend-less search to any website.</p>
<p>To get started, please follow the <a href="https://pagefind.app/docs/#indexing-your-site">Pagefind's instructions</a> on building an index for your website.</p>
<h4>Usage</h4>
<pre>
<code id="htmlViewer" style="color:rgb(51, 51, 51); font-weight:400;background-color:rgb(248, 248, 248);background:rgb(248, 248, 248);display:block;padding: .5em;"><span style="color:rgb(0, 0, 128); font-weight:400;"><<span style="color:rgb(0, 0, 128); font-weight:400;">script</span> <span style="color:rgb(0, 128, 128); font-weight:400;">async</span> <span style="color:rgb(0, 128, 128); font-weight:400;">defer</span> <span style="color:rgb(0, 128, 128); font-weight:400;">type</span>=<span style="color:rgb(221, 17, 68); font-weight:400;">"module"</span> <span style="color:rgb(0, 128, 128); font-weight:400;">src</span>=<span style="color:rgb(221, 17, 68); font-weight:400;">"https://cdn.jsdelivr.net/gh/ovx/searchbox/dist/searchbox.js"</span>></span><span style="color:rgb(0, 0, 128); font-weight:400;"></<span style="color:rgb(0, 0, 128); font-weight:400;">script</span>></span>
<span style="color:rgb(0, 0, 128); font-weight:400;"><<span style="color:rgb(0, 0, 128); font-weight:400;">search-box</span> <span style="color:rgb(0, 128, 128); font-weight:400;">pagefind</span>=<span style="color:rgb(221, 17, 68); font-weight:400;">"https://pagefind.app/_pagefind/pagefind.js"</span>></span>
<span style="color:rgb(0, 0, 128); font-weight:400;"><<span style="color:rgb(0, 0, 128); font-weight:400;">input</span> <span style="color:rgb(0, 128, 128); font-weight:400;">type</span>=<span style="color:rgb(221, 17, 68); font-weight:400;">"search"</span> <span style="color:rgb(0, 128, 128); font-weight:400;">placeholder</span>=<span style="color:rgb(221, 17, 68); font-weight:400;">"Search..."</span> /></span>
<span style="color:rgb(0, 0, 128); font-weight:400;"></<span style="color:rgb(0, 0, 128); font-weight:400;">search-box</span>></span></code></pre>
</div>
<script>
window.addEventListener('load', () => {
document.querySelector('#searchbox').renderers = {
footer: () => `<div class="footer"><a href="https://github.com/ovx/searchbox">Powered by Searchbox</a></div>`,
};
});
</script>
<script async defer type="module" crossorigin src="dist/searchbox.js"></script>
</body>
</html>