From 5cd8dcdd5286f16b39dcaef9227da770a809988b Mon Sep 17 00:00:00 2001 From: Aj - Thomas Date: Mon, 25 Apr 2022 23:33:32 +0200 Subject: [PATCH] Update AppShelf --- components/AppShelf/AddAppShelfItem.tsx | 127 +++++++++++++++ components/AppShelf/AppShelf.d.ts | 15 ++ components/AppShelf/AppShelf.tsx | 200 +++++++++++++----------- components/AppShelf/AppShelfMenu.tsx | 34 ++++ 4 files changed, 281 insertions(+), 95 deletions(-) create mode 100644 components/AppShelf/AddAppShelfItem.tsx create mode 100644 components/AppShelf/AppShelf.d.ts create mode 100644 components/AppShelf/AppShelfMenu.tsx diff --git a/components/AppShelf/AddAppShelfItem.tsx b/components/AppShelf/AddAppShelfItem.tsx new file mode 100644 index 000000000..d916b2e3f --- /dev/null +++ b/components/AppShelf/AddAppShelfItem.tsx @@ -0,0 +1,127 @@ +import { + useMantineTheme, + Modal, + Paper, + Center, + Group, + TextInput, + Image, + Button, + Select, + AspectRatio, + Box, + Text, + Grid, +} from '@mantine/core'; +import { useForm } from '@mantine/hooks'; +import { motion } from 'framer-motion'; +import { useState } from 'react'; +import { Apps } from 'tabler-icons-react'; +import { ServiceTypes } from './AppShelf.d'; + +export default function AddItemShelfItem(props: any) { + const { additem: addItem } = props; + const [opened, setOpened] = useState(false); + const theme = useMantineTheme(); + const form = useForm({ + initialValues: { + type: 'Other', + name: '', + icon: '', + url: '', + }, + + validationRules: {}, + }); + return ( + <> + setOpened(false)} title="Add a service"> + +
+ Placeholder +
+
{ + addItem(form.values); + setOpened(false); + })} + > + + form.setFieldValue('name', event.currentTarget.value)} + error={form.errors.name && 'Invalid name'} + /> + + { + form.setFieldValue('icon', event.currentTarget.value); + }} + error={form.errors.icon && 'Icon url is invalid'} + /> + form.setFieldValue('url', event.currentTarget.value)} + error={form.errors.icon && 'Icon url is invalid'} + /> +