-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: convert public page to single install script tag
- Loading branch information
Showing
1 changed file
with
38 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,88 @@ | ||
<pre class="-my-4"> | ||
<code class="language-javascript"> | ||
import { TrieveModalSearch } from 'trieve-search-component'; | ||
import 'trieve-search-component/styles'; | ||
<link | ||
rel="stylesheet" | ||
href="https://unpkg.com/[email protected]/dist/index.css" | ||
/> | ||
|
||
const App = () => { | ||
return ( | ||
<TrieveModalSearch | ||
<script type="module"> | ||
import {renderToDiv} from 'https://unpkg.com/[email protected]/dist/vanilla/index.js'; | ||
window.addEventListener('load', () => { | ||
const root = document.getElementById('root'); | ||
renderToDiv(root, | ||
{% if params.apiKey -%} | ||
apiKey="{{ params.apiKey }}" | ||
apiKey: "{{ params.apiKey }}" | ||
{% endif -%} | ||
{% if params.baseUrl -%} | ||
baseUrl="{{ params.baseUrl }}" | ||
baseUrl: "{{ params.baseUrl }}" | ||
{% endif -%} | ||
{% if params.type -%} | ||
type="{{ params.type }}" | ||
type: "{{ params.type }}" | ||
{% endif -%} | ||
{% if params.suggestedQueries -%} | ||
suggestedQueries={{ params.suggestedQueries }} | ||
suggestedQueries: {{ params.suggestedQueries }} | ||
{% endif -%} | ||
{% if params.analytics -%} | ||
analytics={{ params.analytics }} | ||
analytics: {{ params.analytics }} | ||
{% endif -%} | ||
{% if params.tags -%} | ||
tags={{ params.tags }} | ||
tags: {{ params.tags }} | ||
{% endif -%} | ||
{% if params.responsive -%} | ||
responsive={{ params.responsive }} | ||
responsive: {{ params.responsive }} | ||
{% endif -%} | ||
{% if params.chat -%} | ||
chat="{{ params.chat}}" | ||
chat: "{{ params.chat}}" | ||
{% endif -%} | ||
{% if params.theme -%} | ||
theme="{{ params.theme }}" | ||
theme: "{{ params.theme }}" | ||
{% endif -%} | ||
{% if params.search_options -%} | ||
search_options={{ params.searchOptions }} | ||
search_options: {{ params.searchOptions }} | ||
{% endif -%} | ||
{% if params.brandLogoImgSrcUrl -%} | ||
brandLogoImgSrcUrl="{{ params.brandLogoImgSrcUrl }}" | ||
brandLogoImgSrcUrl: "{{ params.brandLogoImgSrcUrl }}" | ||
{% endif -%} | ||
{% if params.brandName -%} | ||
brandName="{{ params.brandName }}" | ||
brandName: "{{ params.brandName }}" | ||
{% endif -%} | ||
{% if params.problemLink -%} | ||
problemLink="{{ params.problemLink }}" | ||
problemLink: "{{ params.problemLink }}" | ||
{% endif -%} | ||
{% if params.brandColor -%} | ||
brandColor="{{ params.brandColor }}" | ||
brandColor: "{{ params.brandColor }}" | ||
{% endif -%} | ||
{% if params.placeholder -%} | ||
placeholder="{{ params.placeholder }}" | ||
placeholder: "{{ params.placeholder }}" | ||
{% endif -%} | ||
{% if params.defaultSearchQueries -%} | ||
defaultSearchQueries={{ params.defaultSearchQueries }} | ||
defaultSearchQueries: {{ params.defaultSearchQueries }} | ||
{% endif -%} | ||
{% if params.defaultAiQuestions -%} | ||
defaultAiQuestions={{ params.defaultAiQuestions }} | ||
defaultAiQuestions: {{ params.defaultAiQuestions }} | ||
{% endif -%} | ||
{% if params.defaultSearchMode -%} | ||
defaultSearchMode="{{ params.defaultSearchMode }}" | ||
defaultSearchMode: "{{ params.defaultSearchMode }}" | ||
{% endif -%} | ||
{% if params.useGroupSearch -%} | ||
useGroupSearch={{ params.useGroupSearch }} | ||
useGroupSearch: {{ params.useGroupSearch }} | ||
{% endif -%} | ||
{% if params.allowSwitchingModes -%} | ||
allowSwitchingModes={{ params.allowSwitchingModes }} | ||
allowSwitchingModes: {{ params.allowSwitchingModes }} | ||
{% endif -%} | ||
{% if params.defaultCurrency -%} | ||
defaultCurrency="{{ params.defaultCurrency }}" | ||
defaultCurrency: "{{ params.defaultCurrency }}" | ||
{% endif -%} | ||
{% if params.currencyPosition -%} | ||
currencyPosition="{{ params.currencyPosition }}" | ||
currencyPosition: "{{ params.currencyPosition }}" | ||
{% endif -%} | ||
{% if params.debounceMs -%} | ||
debounceMs={{ params.debounceMs }} | ||
debounceMs: {{ params.debounceMs }} | ||
{% endif -%} | ||
/> | ||
); | ||
} </code> | ||
|
||
) | ||
}); | ||
</script> | ||
|
||
</code> | ||
</pre> |