Skip to content

Commit

Permalink
fix: Tags 컴포넌트 ssr 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
cbcruk committed Aug 5, 2024
1 parent 0c9bd05 commit 4af807d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
9 changes: 1 addition & 8 deletions src/components/Tag/Tags.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
import { useSearchParamsQuery } from '@components/Search/hooks/useSearchParamsQuery'
import type { Props } from './Tags.types'
import clsx from 'clsx'
import type { CSSProperties } from 'react'
import { getRandomColor } from './Tags.utils'

export function Tags({ tags }: Props) {
const q = useSearchParamsQuery()

if (q) {
return null
}

return (
<div className="flex flex-wrap gap-2 mt-4 text-xs">
<div className="flex flex-wrap gap-2 text-xs">
{tags.map((tag) => (
<a
key={tag}
Expand Down
10 changes: 6 additions & 4 deletions src/pages/search.astro
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ const PAGE_DESCRIPTION = ''
<span class="relative text-sm z-[1]" aria-label="검색">🔦</span>
<SearchFormField client:only="react" />
</label>

<Tags client:only="react" tags={tags} />

<SearchForm client:only="react" />
<div class="mt-0">
<SearchForm client:only="react" />
</div>
</div>
<div class="mt-4">
<Tags tags={tags} />
</div>
</Layout>

0 comments on commit 4af807d

Please sign in to comment.