-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(site): add orama search (#1948)
<!-- Please make sure there is an issue that this PR is correlated to. --> ## Changes <!-- If there are frontend changes, please include screenshots. -->
- Loading branch information
Showing
4 changed files
with
309 additions
and
2 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
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
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 |
---|---|---|
@@ -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> | ||
</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", | ||
}} | ||
resultMap={{ | ||
title: "name", | ||
description: "content", | ||
section: "category", | ||
}} | ||
/> | ||
</DialogPortal> | ||
</Dialog> | ||
</> | ||
); | ||
} |
Oops, something went wrong.