import { useSlotRecipe, chakra, Flex, CloseButton, Text, IconButton } from "@chakra-ui/react" import { Undo } from 'lucide-react'; export default function Widget(props) { // deconstructing props const { id, title, isEditable, isDelete, DeleteWidget, isSubmit, setIsSubmit, children } = props; const recipe = useSlotRecipe({ key: "widget" }); const styles = recipe(); return ( {/* HEADER */} {title} {isDelete ? ( DeleteWidget(id)} size="xs" _hover={{bg: "tomato", color: "white"}}/> ):( isSubmit ? ( setIsSubmit(false)} size="xs" bg="base300" cursor="pointer"> ):null )} {/* CHILDREN */} {children} ); }