-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(site): add orama search #1948
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
"use client"; | ||
import { OramaSearchBox } from "@orama/react-components"; | ||
import { Button, Dialog, DialogPortal, Kbd, cn } from "@rivet-gg/components"; | ||
import { useState } from "react"; | ||
|
||
export function HeaderSearch() { | ||
const [isOpen, setIsOpen] = useState(false); | ||
return ( | ||
<> | ||
<Button | ||
onClick={() => setIsOpen(true)} | ||
variant="outline" | ||
className={cn( | ||
"relative h-8 w-full justify-start rounded-[0.5rem] bg-background text-sm font-normal text-muted-foreground shadow-none hidden md:flex md:w-24 lg:w-40", | ||
)} | ||
> | ||
<span className="hidden lg:inline-flex">Search...</span> | ||
<span className="inline-flex lg:hidden">Search...</span> | ||
<Kbd className="absolute right-[0.3rem] top-[0.3rem] hidden sm:flex"> | ||
<Kbd.Cmd />K | ||
</Kbd> | ||
Comment on lines
+19
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: Keyboard shortcut (Cmd+K) is displayed but no keyboard event handler is implemented to handle this shortcut |
||
</Button> | ||
<Dialog open={isOpen}> | ||
<DialogPortal> | ||
<OramaSearchBox | ||
open={isOpen} | ||
layout="modal" | ||
onModalStatusChanged={(status) => setIsOpen(!status)} | ||
colorScheme="system" | ||
onSearchResultClick={() => setIsOpen(false)} | ||
placeholder="Search something..." | ||
index={{ | ||
endpoint: | ||
"https://cloud.orama.run/v1/indexes/rivet-gg-b87fiw", | ||
api_key: "dcVm1fAKZeTdOfGFZCCH9xWiH7JeYCQZ", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: API key should not be hardcoded in the source code. Move this to an environment variable. |
||
}} | ||
resultMap={{ | ||
title: "name", | ||
description: "content", | ||
section: "category", | ||
}} | ||
/> | ||
</DialogPortal> | ||
</Dialog> | ||
</> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: using 'latest' tag can lead to unexpected breaking changes in production. Consider pinning to a specific version