Skip to content

Commit aa1c112

Browse files
committed
feat(algolia): add the shortcuts component
1 parent 0b7f2d3 commit aa1c112

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

assets/algolia/js/index.ts

+18-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { default as params } from '@params'
2929
indexName: params.algolia.indexname,
3030
query,
3131
params: {
32-
hitsPerPage: 10,
32+
hitsPerPage: 5,
3333
attributesToSnippet: ['title:10', 'content:35'],
3434
snippetEllipsisText: '…',
3535
},
@@ -41,6 +41,23 @@ import { default as params } from '@params'
4141
return item.url;
4242
},
4343
templates: {
44+
header({ html }) {
45+
return html`<div class="aa-Header">
46+
<a class="badge bg-secondary mx-2" data-bs-toggle="collapse" href="#aa-shortcuts" role="button" aria-expanded="false" aria-controls="aa-shortcuts">
47+
Shortcuts
48+
</a>
49+
<div class="collapse p-2" id="aa-shortcuts">
50+
<div class="card card-body pb-0">
51+
<ul class="list-unstyled">
52+
<li class="my-2"><kbd>CTRL</kbd>+<kbd>K</kbd> to open</li>
53+
<li class="my-2"><kbd>ESC</kbd> to close</li>
54+
<li class="my-2"><kbd></kbd> <kbd></kbd> to navigate</li>
55+
<li class="my-2"><kbd>ENTER</kbd> to select</li>
56+
</ul>
57+
</div>
58+
</div>
59+
</div>`;
60+
},
4461
item({ item, components, html }) {
4562
return html`<a href="${item.url}" class="aa-ItemWrapper surface px-2 py-1 rounded">
4663
<div class="aa-ItemContent">

purgecss.config.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,20 @@ const purgecss = require('@fullhuman/postcss-purgecss')({
1414
safelist: {
1515
standard: [
1616
'active',
17+
'badge', 'bg-secondary',
1718
'bottom-0',
1819
'btn-primary', 'btn-outline-primary',
20+
'collapse',
1921
'col-xxl-10',
2022
'd-flex',
2123
'end-0',
2224
'fs-lg', 'fs-sm', 'fs-xl', 'fs-xs', 'fst-italic',
2325
'justify-content-center',
24-
'mb-0', 'mb-1',
26+
'mb-0', 'mb-1', 'my-2', 'mx-2',
27+
'list-unstyled',
2528
'offcanvas-backdrop',
2629
'opacity-0', 'opacity-50', 'opacity-100', 'overflow-hidden',
27-
'p-1', 'pe-3', 'pt-0', 'pt-1', 'px-2', 'py-1', 'px-3', 'py-2', 'position-absolute', 'position-fixed', 'position-relative', 'position-sticky',
30+
'p-1', 'pb-0', 'pe-3', 'pt-0', 'pt-1', 'px-2', 'py-1', 'px-3', 'py-2', 'position-absolute', 'position-fixed', 'position-relative', 'position-sticky',
2831
'rounded', 'rounded-top',
2932
'show',
3033
'text-nowrap', 'text-pre-wrap', 'text-uppercase', 'text-white', 'top-0', 'text-bg-secondary', 'text-success', 'text-truncate',

0 commit comments

Comments
 (0)