Skip to content

Commit

Permalink
add pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
imhson committed Sep 18, 2023
1 parent 35397b6 commit c568aa3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/pages/chapter/nftList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ import NoImage from 'images/no_img.png'
import { useTranslation } from 'react-i18next'
import { SubCard } from 'components/Card'
import ShareIcon from 'images/icons/share.svg'
import { useState } from 'react'
import Pagination from '../artist/Pagination'

export default function NFTList({ collections, theme }) {
const [currentPage, setCurrentPage] = useState(1)
const { t } = useTranslation()
const seekhypeBaseUrl = new URL(getConfig().SEEKHYPE_URL).origin
return (
<div className='p-5 flex flex-col gap-5 bg-black lg:py-10 lg:px-0 lg:bg-transparent lg:w-[calc(100%-140px)] lg:gap-10'>
{collections?.map((collection, index) => (
{collections?.slice(currentPage * 2 - 2, currentPage * 2)?.map((collection, index) => (
<SubCard
key={index}
theme={theme}
Expand Down Expand Up @@ -75,6 +78,13 @@ export default function NFTList({ collections, theme }) {
</div>
</SubCard>
))}
{!!collections.length && (
<Pagination
length={Math.ceil(collections.length / 2)}
currentPage={currentPage}
setCurrentPage={setCurrentPage}
/>
)}
</div>
)
}

0 comments on commit c568aa3

Please sign in to comment.