Skip to content

Commit

Permalink
Reduce icons per page
Browse files Browse the repository at this point in the history
  • Loading branch information
Studio384 committed Aug 16, 2023
1 parent bbc7c18 commit f8a47bc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions site/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default function Home({ icons }) {
const { mode, setMode } = useColorScheme();

const [page, setPage] = useState(0);
const iconsPerPage = 90;

const { result, needle, setNeedle } = useSearch(icons, [
"name",
Expand Down Expand Up @@ -115,7 +116,7 @@ export default function Home({ icons }) {
{result.length} icons
</Typography>
<Typography color="neutral">
Page {page + 1} of {Math.ceil(result.length / 180)}
Page {page + 1} of {Math.ceil(result.length / iconsPerPage)}
</Typography>
</Stack>

Expand All @@ -138,7 +139,7 @@ export default function Home({ icons }) {
}}
>
{result
.slice(page * 180, (page + 1) * 180)
.slice(page * iconsPerPage, (page + 1) * iconsPerPage)
.map(({ slug, aiIcon }) => (
<Sheet
key="slug"
Expand Down Expand Up @@ -211,7 +212,7 @@ export default function Home({ icons }) {
variant="solid"
color="primary"
onClick={() => setPage(prev => prev + 1)}
disabled={page === Math.ceil(result.length / 180) - 1}
disabled={page === Math.ceil(result.length / iconsPerPage) - 1}
>
<AmaranthIcon icon={Icons.aiChevronRight} />
</IconButton>
Expand Down

0 comments on commit f8a47bc

Please sign in to comment.