41 lines
1.5 KiB
HTML
41 lines
1.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@meilisearch/instant-meilisearch/templates/basic_search.css" />
|
|
</head>
|
|
<body>
|
|
<div id="app" class="wrapper"></div>
|
|
</body>
|
|
<script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin></script>
|
|
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/react-instantsearch-dom@6.7.0/dist/umd/ReactInstantSearchDOM.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/@meilisearch/instant-meilisearch/dist/instant-meilisearch.umd.min.js"></script>
|
|
<script>
|
|
const { InstantSearch, SearchBox, Hits, Highlight, Configure } = ReactInstantSearchDOM;
|
|
const searchClient = instantMeiliSearch(
|
|
"http://localhost:7700",
|
|
'73xjT1ueTlcXPEKJtzvJxtrlLNOR5q85fJ_TOzoRgcA'
|
|
);
|
|
const App = () => (
|
|
React.createElement(InstantSearch, {
|
|
indexName: "memes",
|
|
searchClient: searchClient
|
|
}, [
|
|
React.createElement(SearchBox, { key: 1 }),
|
|
React.createElement(Hits, { hitComponent: Hit, key: 2 }),
|
|
React.createElement(Configure, { hitsPerPage: 10 })]
|
|
)
|
|
);
|
|
|
|
const Hit = (props) => (
|
|
React.createElement(Highlight, {
|
|
attribute: "id",
|
|
hit: props.hit
|
|
})
|
|
);
|
|
ReactDOM.createRoot(document.querySelector('#app')).render(App());
|
|
console.log(searchClient)
|
|
</script>
|
|
</html>
|