feat: results count

This commit is contained in:
TrèsAbhi committed 2024-10-24 17:50:18 -05:00
1 parent 88acf6bce6
commit f7f11aac58
1 file changed
+9 -3
@@ -1,4 +1,4 @@
import { Flex } from '@radix-ui/themes'; import { Flex, Text } from '@radix-ui/themes';
import fuzzysort from 'fuzzysort'; import fuzzysort from 'fuzzysort';
import { times } from 'lodash-es'; import { times } from 'lodash-es';
import { useMemo, useState } from 'react'; import { useMemo, useState } from 'react';
@@ -14,8 +14,8 @@ export interface Avatar {
id: string; id: string;
} }
const DEFAULT_LOADED = 25; const DEFAULT_LOADED = 42;
const PREVIEW_COUNT = 10; const PREVIEW_COUNT = 14;
export function GalleryList({ avatars }: GalleryListProps) { export function GalleryList({ avatars }: GalleryListProps) {
const search = GalleryEphemeral.use((state) => state.search); const search = GalleryEphemeral.use((state) => state.search);
@@ -33,6 +33,11 @@ export function GalleryList({ avatars }: GalleryListProps) {
}, [search]); }, [search]);
return ( return (
<>
<Text align="center" color="gray">
{filtered.length.toLocaleString()} avatars
</Text>
<Flex wrap="wrap" gap="4"> <Flex wrap="wrap" gap="4">
{filtered.slice(0, loadedCards).map((avatar) => ( {filtered.slice(0, loadedCards).map((avatar) => (
<GalleryCard key={avatar.id} id={avatar.id} name={avatar.name} /> <GalleryCard key={avatar.id} id={avatar.id} name={avatar.name} />
@@ -49,5 +54,6 @@ export function GalleryList({ avatars }: GalleryListProps) {
), ),
)} )}
</Flex> </Flex>
</>
); );
} }