Add stork vanilla component

This commit is contained in:
Sam Carlton 2022-05-10 14:52:27 -05:00
parent 8d0264f3af
commit c9b9bd58e8

View file

@ -0,0 +1,46 @@
---
// Stork Vanilla search
// Stork Eleventy Example - https://github.com/stork-search/netlify-11ty-example
import {
storkVersion,
// storkExecutableName,
// storkExecutablePath,
// storkTomlPath,
// storkIndexPath
} from '~/helpers/stork/config.js'
// const {
// listing
// } = Astro.props
const storkStylesheetURL = `https://files.stork-search.net/releases/v${ storkVersion }/basic.css`
const storkScriptURL = `https://files.stork-search.net/releases/v${ storkVersion }/stork.js`
---
<h1>Search</h1>
<link rel="stylesheet" href={ storkStylesheetURL } />
<div class="stork-wrapper">
<input data-stork="index" class="stork-input" />
<div data-stork="index-output" class="stork-output"></div>
</div>
<script is:inline src={ storkScriptURL }></script>
<script>
import { StorkClient } from '~/helpers/stork/browser.js'
const stork = new StorkClient({
name: 'index',
url: '/search-index.st',
// config: {}
stork: window.stork
})
const queryResult = await stork.lazyQuery( 'spo' )
console.log('queryResult', queryResult)
</script>