Skip to content

Commit ac5de3e

Browse files
committed
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. -->
1 parent e32080d commit ac5de3e

File tree

4 files changed

+309
-2
lines changed

4 files changed

+309
-2
lines changed

site/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"@mdx-js/react": "^2.1.5",
2525
"@next/mdx": "^14.0.1",
2626
"@next/third-parties": "latest",
27+
"@orama/react-components": "^0.3.2",
2728
"@rivet-gg/api": "^0.0.1-rc19",
2829
"@rivet-gg/components": "workspace:*",
2930
"@rivet-gg/icons": "workspace:*",

site/src/components/v2/Header.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import Image from "next/image";
1616
import Link from "next/link";
1717
import { type ReactNode, useState } from "react";
1818
import { HeaderPopupProductMenu } from "../HeaderPopupProductMenu";
19+
import { HeaderSearch } from "./HeaderSearch";
1920

2021
interface HeaderProps {
2122
active: "product" | "docs" | "blog" | "pricing" | "solutions";
@@ -49,6 +50,7 @@ export function Header({ active, subnav }: HeaderProps) {
4950
}
5051
links={
5152
<>
53+
<HeaderSearch />
5254
<RivetHeader.NavItem asChild className="-m-2 p-2">
5355
<Link href="/discord">
5456
<Icon icon={faDiscord} />
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
"use client";
2+
import { OramaSearchBox } from "@orama/react-components";
3+
import { Button, Dialog, DialogPortal, Kbd, cn } from "@rivet-gg/components";
4+
import { useState } from "react";
5+
6+
export function HeaderSearch() {
7+
const [isOpen, setIsOpen] = useState(false);
8+
return (
9+
<>
10+
<Button
11+
onClick={() => setIsOpen(true)}
12+
variant="outline"
13+
className={cn(
14+
"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",
15+
)}
16+
>
17+
<span className="hidden lg:inline-flex">Search...</span>
18+
<span className="inline-flex lg:hidden">Search...</span>
19+
<Kbd className="absolute right-[0.3rem] top-[0.3rem] hidden sm:flex">
20+
<Kbd.Cmd />K
21+
</Kbd>
22+
</Button>
23+
<Dialog open={isOpen}>
24+
<DialogPortal>
25+
<OramaSearchBox
26+
open={isOpen}
27+
layout="modal"
28+
onModalStatusChanged={(status) => setIsOpen(!status)}
29+
colorScheme="system"
30+
onSearchResultClick={() => setIsOpen(false)}
31+
placeholder="Search something..."
32+
index={{
33+
endpoint:
34+
"https://cloud.orama.run/v1/indexes/rivet-gg-b87fiw",
35+
api_key: "dcVm1fAKZeTdOfGFZCCH9xWiH7JeYCQZ",
36+
}}
37+
resultMap={{
38+
title: "name",
39+
description: "content",
40+
section: "category",
41+
}}
42+
/>
43+
</DialogPortal>
44+
</Dialog>
45+
</>
46+
);
47+
}

0 commit comments

Comments
 (0)