// react import React, { useState } from "react"; // react-hook-form import { Controller, useForm } from "react-hook-form"; // headless ui import { Popover, Transition } from "@headlessui/react"; // ui import { PencilIcon, RectangleGroupIcon } from "@heroicons/react/24/outline"; import { TwitterPicker } from "react-color"; import { Button, CustomMenu, Input } from "components/ui"; // icons // types import { IIssueLabels } from "types"; type Props = { label: IIssueLabels; issueLabels: IIssueLabels[]; editLabel: (label: IIssueLabels) => void; handleLabelDelete: (labelId: string) => void; }; const defaultValues: Partial = { name: "", color: "#ff0000", }; const SingleLabel: React.FC = ({ label, issueLabels, editLabel, handleLabelDelete }) => { const [newLabelForm, setNewLabelForm] = useState(false); const { register, formState: { errors, isSubmitting }, watch, control, } = useForm({ defaultValues }); const children = issueLabels?.filter((l) => l.parent === label.id); return ( <> {children && children.length === 0 ? (
{label.name}
{/* Convert to group */} editLabel(label)}>Edit handleLabelDelete(label.id)}> Delete
{({ open }) => ( <> {watch("color") && watch("color") !== "" && ( )} ( onChange(value.hex)} /> )} /> )}
) : (

This is the label group title

This is the label title
)} ); }; export default SingleLabel;