From 02281995dfc8b8c849bb45ef0cc70d0a7f65cf5b Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Thu, 22 Aug 2024 01:29:29 +0200 Subject: [PATCH] use Carousel --- .../src/components/settings/QuickAction.tsx | 83 +++++++++++++++---- 1 file changed, 66 insertions(+), 17 deletions(-) diff --git a/src/frontend/src/components/settings/QuickAction.tsx b/src/frontend/src/components/settings/QuickAction.tsx index 5a07454919..e4aff43512 100644 --- a/src/frontend/src/components/settings/QuickAction.tsx +++ b/src/frontend/src/components/settings/QuickAction.tsx @@ -1,9 +1,11 @@ import { Trans, t } from '@lingui/macro'; +import { Carousel } from '@mantine/carousel'; import { + Button, Divider, Flex, + Group, Paper, - SimpleGrid, Stack, Text, Title @@ -11,7 +13,48 @@ import { import { IconHome } from '@tabler/icons-react'; import { ActionButton } from '../buttons/ActionButton'; -import { PlaceholderPill } from '../items/Placeholder'; + +interface ActionItem { + id: string; + title: string; + description: string; + action: () => void; +} + +function ActionCarousel({ items }: { items: ActionItem[] }) { + const slides = items.map((image) => ( + + + + + + {image.title} +
+ {image.description} +
+
+ +
+
+
+ )); + + return ( + + {slides} + + ); +} export const QuickAction = ({ navigate, @@ -20,6 +63,26 @@ export const QuickAction = ({ navigate?: any; ml?: string; }) => { + const items = [ + { + id: '1', + title: 'Add a new group', + description: 'Create a new group to manage your users', + action: () => console.log('Add a new group') + }, + { + id: '2', + title: 'Add a new user', + description: 'Create a new user to manage your groups', + action: () => console.log('Add a new user') + }, + { + id: '3', + title: 'Add a new role', + description: 'Create a new role to manage your permissions', + action: () => console.log('Add a new role') + } + ]; return ( @@ -40,21 +103,7 @@ export const QuickAction = ({ <Divider orientation="vertical" mx="md" /> </> ) : null} - <SimpleGrid cols={3}> - <Paper shadow="xs" p="sm" withBorder> - <Text> - <Trans>Add a new user</Trans> - </Text> - </Paper> - - <Paper shadow="xs" p="sm" withBorder> - <PlaceholderPill /> - </Paper> - - <Paper shadow="xs" p="sm" withBorder> - <PlaceholderPill /> - </Paper> - </SimpleGrid> + <ActionCarousel items={items} /> </Flex> </Stack> );