From f56e38379863db491c595f26e52b747321f036e0 Mon Sep 17 00:00:00 2001 From: Varun Murlidhar Date: Tue, 23 Apr 2024 18:29:23 -0400 Subject: [PATCH] Add tag fields to drawer, style drawer --- compass/components/page/Drawer.tsx | 57 +++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 16 deletions(-) diff --git a/compass/components/page/Drawer.tsx b/compass/components/page/Drawer.tsx index d9d99ab..95c96fc 100644 --- a/compass/components/page/Drawer.tsx +++ b/compass/components/page/Drawer.tsx @@ -4,6 +4,7 @@ import { ChevronDoubleLeftIcon } from '@heroicons/react/24/solid'; import { BookmarkIcon, XMarkIcon, StarIcon as SolidStarIcon, EnvelopeIcon, UserIcon } from "@heroicons/react/24/solid"; import { ArrowsPointingOutIcon, ArrowsPointingInIcon, StarIcon as OutlineStarIcon, ListBulletIcon } from '@heroicons/react/24/outline'; import Card from '@/components/page/Card' +import TagsInput from '../TagsInput/Index'; @@ -72,6 +73,19 @@ const Drawer: FunctionComponent = ({ title, children, onSave, edita const favoriteIcon = isFavorite ? : + const [presetOptions, setPresetOptions] = useState(["administrator", "volunteer", "employee"]); + const [rolePresetOptions, setRolePresetOptions] = useState(["domestic", "community", "economic"]); + const [tagColors, setTagColors] = useState(new Map()); + + const getTagColor = (tag: string) => { + if (!tagColors.has(tag)) { + const colors = ["bg-cyan-100", "bg-blue-100", "bg-green-100", "bg-yellow-100", "bg-purple-100"]; + const randomColor = colors[Math.floor(Math.random() * colors.length)]; + setTagColors(new Map(tagColors).set(tag, randomColor)); + } + return tagColors.get(tag); + }; + return (
@@ -97,13 +111,13 @@ const Drawer: FunctionComponent = ({ title, children, onSave, edita
- + -
+
- + - -
+
- + - -
+
- + - -
+
- + -
UsernameUsername + = ({ title, children, onSave, edita />
RoleRole - {rowContent.role} + +
EmailEmail +
Type of ProgramType of Program - {rowContent.program} + + {/* {rowContent.program} */} +