Skip to content

Commit 176670c

Browse files
committed
style(fastsearch.js): improve search result item layout and add icons
1 parent 57a82e4 commit 176670c

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

assets/js/fastsearch.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ sInput.onkeyup = function (e) {
7979
if (fuse) {
8080
let results;
8181
if (params.fuseOpts) {
82-
results = fuse.search(this.value.trim(), {limit: params.fuseOpts.limit}); // the actual query being run using fuse.js along with options
82+
results = fuse.search(this.value.trim(), { limit: params.fuseOpts.limit }); // the actual query being run using fuse.js along with options
8383
} else {
8484
results = fuse.search(this.value.trim()); // the actual query being run using fuse.js
8585
}
@@ -88,8 +88,12 @@ sInput.onkeyup = function (e) {
8888
let resultSet = ''; // our results bucket
8989

9090
for (let item in results) {
91-
resultSet += `<li class="post-entry"><header class="entry-header">${results[item].item.title}&nbsp;»</header>` +
92-
`<a href="${results[item].item.permalink}" aria-label="${results[item].item.title}"></a></li>`
91+
resultSet +=
92+
`<li>` +
93+
`${results[item].item.title}` +
94+
`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevrons-right"><polyline points="13 17 18 12 13 7"></polyline><polyline points="6 17 11 12 6 7"></polyline></svg>` +
95+
`<a class="entry-link" href="${results[item].item.permalink}" aria-label="${results[item].item.title}"></a>` +
96+
`</li>`
9397
}
9498

9599
resList.innerHTML = resultSet;

0 commit comments

Comments
 (0)