mirror of
https://github.com/jorgev259/soc_site-astro.git
synced 2025-06-29 07:57:41 +00:00
search update
This commit is contained in:
parent
af3cede125
commit
7005eec4c1
3 changed files with 46 additions and 21 deletions
25
src/components/search/SearchNav.astro
Normal file
25
src/components/search/SearchNav.astro
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
interface Props {
|
||||
count: number
|
||||
take: number
|
||||
page: number
|
||||
query: string
|
||||
}
|
||||
|
||||
const { count, take, page, query } = Astro.props
|
||||
const pageCount = Math.ceil(count / take)
|
||||
---
|
||||
|
||||
{
|
||||
pageCount > 1
|
||||
? Array.from({ length: pageCount }, (_, i) =>
|
||||
page === i + 1 ? (
|
||||
<span class='bg-gray rounded px-2 cursor-pointer'>{i + 1}</span>
|
||||
) : (
|
||||
<a class='bg-gray/50 rounded px-2' href={`/search?q=${query}&page=${i + 1}`}>
|
||||
{i + 1}
|
||||
</a>
|
||||
)
|
||||
)
|
||||
: null
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue