Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions app/_components/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import { Pump } from 'basehub/react-pump'
import { HeaderFragment, PagesNav } from './pages-nav'
import { Box, Container, Flex, Grid } from '@radix-ui/themes'
import {
DialogTriggerDesktop,
// DialogTriggerDesktop,
DialogTriggerMobile,
SearchProvider,
} from './search'
import { Logo } from '../logo'
import { TopRightNavDesktop, TopRightNavMobile } from './header-nav'
import { PageMetaFragment } from '@/basehub-helpers/fragments'
import { InputNeue } from './search/input-neue'

import s from './header.module.scss'

Expand Down Expand Up @@ -93,7 +94,8 @@ export const Header = () => {
width="100%"
justify="start"
>
<DialogTriggerDesktop />
<InputNeue />
{/* <DialogTriggerDesktop /> */}
</Flex>
</Box>

Expand Down
31 changes: 31 additions & 0 deletions app/_components/header/search/actions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'use server'

import { basehub } from 'basehub'

export const searchNeue = async (query: string) => {
const result = await basehub().query({
_componentInstances: {
article: {
__args: {
search: {
q: query,
by: ['_title', 'body', 'excerpt'],
},
},
items: {
_id: true,
_slugPath: true,
_title: true,
_highlight: {
by: true,
snippet: true,
},
},
},
},
})

console.log(result)

return result
}
17 changes: 17 additions & 0 deletions app/_components/header/search/input-neue.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use client'
import { searchNeue } from './actions'

export const InputNeue = () => {
return (
<input
type="text"
onChange={(e) => {
const now = performance.now()
searchNeue(e.target.value).then((res) => {
console.log(res)
console.log('Search time:', performance.now() - now, 'ms')
})
}}
/>
)
}
Loading