mirror of
https://github.com/docmost/docmost.git
synced 2025-11-14 16:51:47 +10:00
show button only if necessary
This commit is contained in:
@ -13,9 +13,9 @@ import { IconArrowRight } from "@tabler/icons-react";
|
|||||||
|
|
||||||
export default function SpaceGrid() {
|
export default function SpaceGrid() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { data, isLoading } = useGetSpacesQuery({ page: 1, limit: 9 });
|
const { data, isLoading } = useGetSpacesQuery({ page: 1, limit: 10 });
|
||||||
|
|
||||||
const cards = data?.items.map((space, index) => (
|
const cards = data?.items.slice(0, 9).map((space, index) => (
|
||||||
<Card
|
<Card
|
||||||
key={space.id}
|
key={space.id}
|
||||||
p="xs"
|
p="xs"
|
||||||
@ -55,17 +55,19 @@ export default function SpaceGrid() {
|
|||||||
|
|
||||||
<SimpleGrid cols={{ base: 1, xs: 2, sm: 3 }}>{cards}</SimpleGrid>
|
<SimpleGrid cols={{ base: 1, xs: 2, sm: 3 }}>{cards}</SimpleGrid>
|
||||||
|
|
||||||
<Group justify="flex-end" mt="lg">
|
{data?.items && data.items.length > 9 && (
|
||||||
<Button
|
<Group justify="flex-end" mt="lg">
|
||||||
component={Link}
|
<Button
|
||||||
to="/spaces"
|
component={Link}
|
||||||
variant="subtle"
|
to="/spaces"
|
||||||
rightSection={<IconArrowRight size={16} />}
|
variant="subtle"
|
||||||
size="sm"
|
rightSection={<IconArrowRight size={16} />}
|
||||||
>
|
size="sm"
|
||||||
{t("View all spaces")}
|
>
|
||||||
</Button>
|
{t("View all spaces")}
|
||||||
</Group>
|
</Button>
|
||||||
|
</Group>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user