|
|
|
|
@ -1,14 +1,20 @@
|
|
|
|
|
'use client'
|
|
|
|
|
|
|
|
|
|
import { useMarketplaceContext } from '../context'
|
|
|
|
|
import { useMixedTranslation } from '../hooks'
|
|
|
|
|
import {
|
|
|
|
|
useMixedTranslation,
|
|
|
|
|
useSearchBoxAutoAnimate,
|
|
|
|
|
} from '../hooks'
|
|
|
|
|
import SearchBox from './index'
|
|
|
|
|
import cn from '@/utils/classnames'
|
|
|
|
|
|
|
|
|
|
type SearchBoxWrapperProps = {
|
|
|
|
|
locale?: string
|
|
|
|
|
searchBoxAutoAnimate?: boolean
|
|
|
|
|
}
|
|
|
|
|
const SearchBoxWrapper = ({
|
|
|
|
|
locale,
|
|
|
|
|
searchBoxAutoAnimate,
|
|
|
|
|
}: SearchBoxWrapperProps) => {
|
|
|
|
|
const { t } = useMixedTranslation(locale)
|
|
|
|
|
const intersected = useMarketplaceContext(v => v.intersected)
|
|
|
|
|
@ -16,12 +22,14 @@ const SearchBoxWrapper = ({
|
|
|
|
|
const handleSearchPluginTextChange = useMarketplaceContext(v => v.handleSearchPluginTextChange)
|
|
|
|
|
const filterPluginTags = useMarketplaceContext(v => v.filterPluginTags)
|
|
|
|
|
const handleFilterPluginTagsChange = useMarketplaceContext(v => v.handleFilterPluginTagsChange)
|
|
|
|
|
const { searchBoxCanAnimate } = useSearchBoxAutoAnimate(searchBoxAutoAnimate)
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<SearchBox
|
|
|
|
|
inputClassName={cn(
|
|
|
|
|
'sticky top-3 mx-auto w-[640px] shrink-0',
|
|
|
|
|
!intersected && 'w-[508px] transition-[width] duration-300',
|
|
|
|
|
'mx-auto w-[640px] shrink-0 z-[0]',
|
|
|
|
|
searchBoxCanAnimate && 'sticky top-3 z-[11]',
|
|
|
|
|
!intersected && searchBoxCanAnimate && 'w-[508px] transition-[width] duration-300',
|
|
|
|
|
)}
|
|
|
|
|
search={searchPluginText}
|
|
|
|
|
onSearchChange={handleSearchPluginTextChange}
|
|
|
|
|
|