fix import and add fallback

This commit is contained in:
yujonglee 2024-07-26 22:00:48 +09:00
parent c54f23f936
commit 8a45abb563

View file

@ -24,7 +24,7 @@ export default function SearchBarWrapper(props) {
import("@getcanary/web/components/canary-content"),
import("@getcanary/web/components/canary-search"),
import("@getcanary/web/components/canary-search-input"),
import("@getcanary/web/components/canary-search-results"),
import("@getcanary/web/components/canary-search-results-group"),
import("@getcanary/web/components/canary-footer"),
import("@getcanary/web/components/canary-callout-calendly"),
import("@getcanary/web/components/canary-callout-discord"),
@ -33,10 +33,6 @@ export default function SearchBarWrapper(props) {
.catch(console.error);
}, []);
if (!loaded || !path) {
return null;
}
return (
<div
style={{
@ -46,6 +42,9 @@ export default function SearchBarWrapper(props) {
gap: "6px",
}}
>
{!loaded || !path ? (
<span style={{ fontSize: "2rem" }}>🐤</span>
) : (
<canary-root framework="docusaurus">
<canary-provider-pagefind
options={JSON.stringify({ ...options, path })}
@ -77,6 +76,7 @@ export default function SearchBarWrapper(props) {
</canary-modal>
</canary-provider-pagefind>
</canary-root>
)}
<SearchBar {...props} />
</div>