mirror of
https://github.com/koreanbots/core.git
synced 2025-12-15 14:10:22 +00:00
feat: paginator scroll to list
This commit is contained in:
parent
25fd0510f6
commit
f95ea30a38
@ -29,7 +29,7 @@ const Paginator = ({ currentPage, totalPage, pathname }: PaginatorProps): JSX.El
|
||||
return (
|
||||
<div className='flex flex-col items-center justify-center py-4 text-center'>
|
||||
<div className='flex'>
|
||||
<Link href={{ pathname, query: { page: currentPage - 1 } }}>
|
||||
<Link href={{ pathname, hash: 'list', query: { page: currentPage - 1 } }}>
|
||||
<a
|
||||
className={`${
|
||||
currentPage === 1 ? 'invisible' : ''
|
||||
@ -39,7 +39,7 @@ const Paginator = ({ currentPage, totalPage, pathname }: PaginatorProps): JSX.El
|
||||
</a>
|
||||
</Link>
|
||||
{pages.map((el, i) => (
|
||||
<Link key={i} href={{ pathname, query: { page: el } }}>
|
||||
<Link key={i} href={{ pathname, hash: 'list', query: { page: el } }}>
|
||||
<a
|
||||
className={`w-12 flex justify-center items-center cursor-pointer leading-5 transition duration-150 ease-in ${
|
||||
i === 0 && i === pages.length - 1
|
||||
@ -59,7 +59,7 @@ const Paginator = ({ currentPage, totalPage, pathname }: PaginatorProps): JSX.El
|
||||
</a>
|
||||
</Link>
|
||||
))}
|
||||
<Link href={{ pathname, query: { page: currentPage + 1 } }}>
|
||||
<Link href={{ pathname, hash: 'list', query: { page: currentPage + 1 } }}>
|
||||
<a
|
||||
className={`${
|
||||
currentPage === totalPage ? 'invisible' : ''
|
||||
|
||||
@ -23,16 +23,18 @@ const Votes:NextPage<VotesProps> = ({ data }) => {
|
||||
return <>
|
||||
<Hero header='하트 랭킹' description='하트를 많이 받은 봇들의 순위입니다!'/>
|
||||
<SEO title='하트 랭킹' description='하트를 많이 받은 봇들의 순위입니다!'/>
|
||||
<Container>
|
||||
<Advertisement />
|
||||
<ResponsiveGrid>
|
||||
{
|
||||
data.data.map(bot => <BotCard key={bot.id} bot={bot} /> )
|
||||
}
|
||||
</ResponsiveGrid>
|
||||
<Paginator totalPage={data.totalPage} currentPage={data.currentPage} pathname='/list/votes' />
|
||||
<Advertisement />
|
||||
</Container>
|
||||
<section id='list'>
|
||||
<Container>
|
||||
<Advertisement />
|
||||
<ResponsiveGrid>
|
||||
{
|
||||
data.data.map(bot => <BotCard key={bot.id} bot={bot} /> )
|
||||
}
|
||||
</ResponsiveGrid>
|
||||
<Paginator totalPage={data.totalPage} currentPage={data.currentPage} pathname='/list/votes' />
|
||||
<Advertisement />
|
||||
</Container>
|
||||
</section>
|
||||
</>
|
||||
}
|
||||
export const getServerSideProps = async (ctx:Context) => {
|
||||
|
||||
@ -26,20 +26,22 @@ const Search:NextPage<SearchProps> = ({ data, query }) => {
|
||||
return <>
|
||||
<Hero header={`"${query.q}" 검색 결과`} description={`'${query.q}' 에 대한 검색 결과입니다.`} />
|
||||
<SEO title={`"${query.q}" 검색 결과`} description={`'${query.q}' 에 대한 검색 결과입니다.`} />
|
||||
<Container>
|
||||
<Advertisement />
|
||||
{ !data || data.data.length === 0 ? <h1 className='text-3xl font-bold text-center py-20'>검색 결과가 없습니다.</h1> :
|
||||
<>
|
||||
<ResponsiveGrid>
|
||||
{
|
||||
data.data.map(bot => <BotCard key={bot.id} bot={bot} /> )
|
||||
}
|
||||
</ResponsiveGrid>
|
||||
<Paginator totalPage={data.totalPage} currentPage={data.currentPage} pathname={`/search?q=${query.q}`} />
|
||||
</>
|
||||
}
|
||||
<Advertisement />
|
||||
</Container>
|
||||
<section id='list'>
|
||||
<Container>
|
||||
<Advertisement />
|
||||
{ !data || data.data.length === 0 ? <h1 className='text-3xl font-bold text-center py-20'>검색 결과가 없습니다.</h1> :
|
||||
<>
|
||||
<ResponsiveGrid>
|
||||
{
|
||||
data.data.map(bot => <BotCard key={bot.id} bot={bot} /> )
|
||||
}
|
||||
</ResponsiveGrid>
|
||||
<Paginator totalPage={data.totalPage} currentPage={data.currentPage} pathname={`/search?q=${query.q}`} />
|
||||
</>
|
||||
}
|
||||
<Advertisement />
|
||||
</Container>
|
||||
</section>
|
||||
</>
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user