refactor: search
This commit is contained in:
parent
88567c2c13
commit
0153465e29
24 changed files with 785 additions and 345 deletions
|
|
@ -1,17 +0,0 @@
|
|||
import { SearchDialog } from '@/components/SearchDialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Search } from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
|
||||
export default function SearchButton() {
|
||||
const [open, setOpen] = useState(false)
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button variant="ghost" size="titlebar-icon" onClick={() => setOpen(true)}>
|
||||
<Search />
|
||||
</Button>
|
||||
<SearchDialog open={open} setOpen={setOpen} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
@ -1,18 +1,19 @@
|
|||
import { useSecondaryPage } from '@/PageManager'
|
||||
import BookmarkList from '@/components/BookmarkList'
|
||||
import PostEditor from '@/components/PostEditor'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import PrimaryPageLayout from '@/layouts/PrimaryPageLayout'
|
||||
import { toSearch } from '@/lib/link'
|
||||
import { useFeed } from '@/providers/FeedProvider'
|
||||
import { useNostr } from '@/providers/NostrProvider'
|
||||
import { useScreenSize } from '@/providers/ScreenSizeProvider'
|
||||
import { TPageRef } from '@/types'
|
||||
import { PencilLine } from 'lucide-react'
|
||||
import { PencilLine, Search } from 'lucide-react'
|
||||
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import FeedButton from './FeedButton'
|
||||
import FollowingFeed from './FollowingFeed'
|
||||
import RelaysFeed from './RelaysFeed'
|
||||
import SearchButton from './SearchButton'
|
||||
|
||||
const NoteListPage = forwardRef((_, ref) => {
|
||||
const { t } = useTranslation()
|
||||
|
|
@ -76,10 +77,12 @@ function NoteListPageTitlebar() {
|
|||
return (
|
||||
<div className="flex gap-1 items-center h-full justify-between">
|
||||
<FeedButton className="flex-1 max-w-fit w-0" />
|
||||
<div className="shrink-0 flex gap-1 items-center">
|
||||
<SearchButton />
|
||||
{isSmallScreen && <PostButton />}
|
||||
</div>
|
||||
{isSmallScreen && (
|
||||
<div className="shrink-0 flex gap-1 items-center">
|
||||
<SearchButton />
|
||||
<PostButton />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -106,3 +109,13 @@ function PostButton() {
|
|||
</>
|
||||
)
|
||||
}
|
||||
|
||||
function SearchButton() {
|
||||
const { push } = useSecondaryPage()
|
||||
|
||||
return (
|
||||
<Button variant="ghost" size="titlebar-icon" onClick={() => push(toSearch())}>
|
||||
<Search />
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue