diff --git a/compass/components/Button.tsx b/compass/components/Button.tsx index 0ebfe6c..0fe0c8a 100644 --- a/compass/components/Button.tsx +++ b/compass/components/Button.tsx @@ -9,7 +9,7 @@ type ButtonProps = { const Button: FunctionComponent = ({ children, type, disabled, onClick}) => { - const buttonClassName = `inline-block rounded border ${disabled ? 'bg-gray-400 text-gray-600 cursor-not-allowed' : 'border-purple-600 bg-purple-600 text-white hover:bg-transparent hover:text-purple-600 focus:outline-none focus:ring active:text-purple-500'} px-4 py-1 text-md font-semibold w-20 h-10 text-center`; + const buttonClassName = ` inline-block rounded border ${disabled ? 'bg-gray-400 text-gray-600 cursor-not-allowed' : 'border-purple-600 bg-purple-600 text-white hover:bg-transparent hover:text-purple-600 focus:outline-none focus:ring active:text-purple-500'} px-4 py-1 text-md font-semibold w-20 h-10 text-center`; return ( -
*]:rounded z-10" + (!menuOpen ? " invisible" : "")} - > - - { /* handle open */ }} /> - + +
*]:rounded z-10" + + (!menuOpen ? " invisible" : "") + } + > + + { + /* handle open */ + }} + /> +
- + ); -} +}; diff --git a/compass/components/Table/TableAction.tsx b/compass/components/Table/TableAction.tsx index 0b20d32..437e42a 100644 --- a/compass/components/Table/TableAction.tsx +++ b/compass/components/Table/TableAction.tsx @@ -43,8 +43,8 @@ export const TableAction: FunctionComponent = ({ Filter {showFilterBox && } - Sort - + Sort + { - const [tagColor, setTagColor] = useState(''); - return ( - + {children} {active && handleDelete && ( )} ); -}; \ No newline at end of file +}; diff --git a/compass/components/TagsInput/TagsArray.tsx b/compass/components/TagsInput/TagsArray.tsx index 59d8aa1..af8d725 100644 --- a/compass/components/TagsInput/TagsArray.tsx +++ b/compass/components/TagsInput/TagsArray.tsx @@ -3,7 +3,7 @@ import { Tag } from "./Tag" export const TagsArray = ({ tags, handleDelete, active = false }) => { return( -
+
{ Array.from(tags).map((tag) => { return ( diff --git a/compass/components/page/Drawer.tsx b/compass/components/page/Drawer.tsx index 95c96fc..1601453 100644 --- a/compass/components/page/Drawer.tsx +++ b/compass/components/page/Drawer.tsx @@ -1,184 +1,246 @@ -import { FunctionComponent, ReactElement, ReactNode } from 'react'; -import React, { useState } from 'react'; -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'; - - +import { FunctionComponent, ReactNode } from "react"; +import React, { useState } from "react"; +import { ChevronDoubleLeftIcon } from "@heroicons/react/24/solid"; +import { + StarIcon as SolidStarIcon, + EnvelopeIcon, + UserIcon, +} from "@heroicons/react/24/solid"; +import { + ArrowsPointingOutIcon, + ArrowsPointingInIcon, + StarIcon as OutlineStarIcon, + ListBulletIcon, +} from "@heroicons/react/24/outline"; +import TagsInput from "../TagsInput/Index"; type DrawerProps = { - title: string; - children: ReactNode; - onClick?: (event: React.MouseEvent) => void; - type?: "button" | "submit" | "reset"; // specify possible values for type - disabled?: boolean; - editableContent?: any; - onSave?: (content: any) => void; - rowContent?: any; - onRowUpdate?: (content: any) => void; + title: string; + children: ReactNode; + onClick?: (event: React.MouseEvent) => void; + type?: "button" | "submit" | "reset"; // specify possible values for type + disabled?: boolean; + editableContent?: any; + onSave?: (content: any) => void; + rowContent?: any; + onRowUpdate?: (content: any) => void; }; interface EditContent { - content: string; - isEditing: boolean; + content: string; + isEditing: boolean; } +const Drawer: FunctionComponent = ({ + title, + children, + onSave, + editableContent, + rowContent, + onRowUpdate, +}) => { + const [isOpen, setIsOpen] = useState(false); + const [isFull, setIsFull] = useState(false); + const [isFavorite, setIsFavorite] = useState(false); + const [tempRowContent, setTempRowContent] = useState(rowContent); -const Drawer: FunctionComponent = ({ title, children, onSave, editableContent, rowContent, onRowUpdate }) => { - const [isOpen, setIsOpen] = useState(false); - const [isFull, setIsFull] = useState(false); - const [currentCardIcon, setCurrentCardIcon] = useState(''); - const [isFavorite, setIsFavorite] = useState(false); - const [tempRowContent, setTempRowContent] = useState(rowContent); + const handleTempRowContentChange = (e) => { + const { name, value } = e.target; + console.log(name); + console.log(value); + setTempRowContent((prevContent) => ({ + ...prevContent, + [name]: value, + })); + }; - const handleTempRowContentChange = (e) => { - const { name, value } = e.target; - console.log(name); - console.log(value); - setTempRowContent((prevContent) => ({ - ...prevContent, - [name]: value, - })); - }; - - const handleEnterPress = (e) => { - if (e.key === 'Enter') { - e.preventDefault(); - // Update the rowContent with the temporaryRowContent - if(onRowUpdate) { - onRowUpdate(tempRowContent); - } - } - }; - - const toggleDrawer = () => { - setIsOpen(!isOpen); - if (isFull) { - setIsFull(!isFull); - } + const handleEnterPress = (e) => { + if (e.key === "Enter") { + e.preventDefault(); + // Update the rowContent with the temporaryRowContent + if (onRowUpdate) { + onRowUpdate(tempRowContent); + } } + }; - const toggleDrawerFullScreen = () => setIsFull(!isFull); + const toggleDrawer = () => { + setIsOpen(!isOpen); + if (isFull) { + setIsFull(!isFull); + } + }; - const toggleFavorite = () => setIsFavorite(!isFavorite); + const toggleDrawerFullScreen = () => setIsFull(!isFull); - const drawerClassName = `fixed top-0 right-0 w-1/2 h-full bg-white transform ease-in-out duration-300 z-20 ${ - isOpen ? "translate-x-0 shadow-xl" : "translate-x-full" + const toggleFavorite = () => setIsFavorite(!isFavorite); - } ${isFull ? "w-full" : "w-1/2"}`; + const drawerClassName = `fixed top-0 right-0 w-1/2 h-full bg-white transform ease-in-out duration-300 z-20 ${ + isOpen ? "translate-x-0 shadow-xl" : "translate-x-full" + } ${isFull ? "w-full" : "w-1/2"}`; - const iconComponent = isFull ? : ; + const iconComponent = isFull ? ( + + ) : ( + + ); - const favoriteIcon = isFavorite ? : + const favoriteIcon = isFavorite ? ( + + ) : ( + + ); - const [presetOptions, setPresetOptions] = useState(["administrator", "volunteer", "employee"]); - const [rolePresetOptions, setRolePresetOptions] = useState(["domestic", "community", "economic"]); - const [tagColors, setTagColors] = useState(new Map()); + 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)); + 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 ( +
+ -
-
-
-
- {currentCardIcon} -

{rowContent.username}

-
-
- - - -
-
-
- - - -
-
- - - - - -
-
- - - - - -
-
- - - - - -
-
- - - - - -
Username -
Role - -
Email -
Type of Program - {/* {rowContent.program} */} - -
-
-
-
+ onClick={toggleDrawer} + > + Open + +
+
+
+
+ + + +

+ {rowContent.username} +

+
+
+ + + +
- ); +
+ + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+ + Username + +
+ + Role + +
+ + Email + +
+ + Type of Program + {/* {rowContent.program} */} + +
+
+
+
+
+ ); }; export default Drawer; -