search-modal
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "search-modal", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Vanilla JS Search Modal", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -16,3 +16,3 @@ # Search Modal | ||
searchUrl: "", // to search from server | ||
queryParam: "query", | ||
searchKey: "query", | ||
// only applicable when the `searchUrl` is not provided, to search from static data or preloaded data | ||
@@ -22,2 +22,4 @@ data:[ | ||
title: "Example", | ||
category: "Category", | ||
summary: "Summary of example one", | ||
url: "/example" | ||
@@ -27,2 +29,4 @@ }, | ||
title: "Example 2", | ||
category: "Category", | ||
summary: "Another brief example", | ||
url: "/example-2" | ||
@@ -34,5 +38,5 @@ } | ||
title: item.title, | ||
category: item.category.name, | ||
category: item.category, | ||
excerpt: item.summary, | ||
url: item.link, | ||
url: item.url, | ||
})), | ||
@@ -48,2 +52,26 @@ callback: (event, data) => { | ||
## unpkg usage by @dandv | ||
``` | ||
<link rel="stylesheet" href="https://search-modal.msar.me/dist/style.css"> | ||
<script type="module"> | ||
import SearchModal from 'https://unpkg.com/search-modal?module'; | ||
const instance = SearchModal({ ... }); | ||
// Activate on Cmd/Ctrl+K | ||
document.addEventListener("keydown", (event) => { | ||
if ((event.ctrlKey || event.metaKey) && event.key === "k") { | ||
event.preventDefault(); | ||
instance.open(); | ||
} | ||
}); | ||
</script> | ||
``` | ||
## Example | ||
![demo](./screenshot.png) | ||
[Demo](https://search-modal.msar.me/) | ||
## To Do | ||
@@ -56,3 +84,3 @@ | ||
This project was inspired from by algolia DocSearch modal which is tightly binded with algolia, that's why we write this package to provide smooth search experience. | ||
The design provided by @atiq-ur and developed by @4msar | ||
The design provided by [Atiqur Rahman](//github.com/atiq-ur) and developed by [Saiful Alam](//github.com/4msar) | ||
Sorry, the diff of this file is not supported yet
75249
17
81