// 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 { Button, CustomMenu, Input } from "ui"; // icons import { PencilIcon, RectangleGroupIcon } from "@heroicons/react/24/outline"; // types import { IIssueLabels } from "types"; import { TwitterPicker } from "react-color"; type Props = { label: IIssueLabels; issueLabels: IIssueLabels[]; editLabel: (label: IIssueLabels) => void; handleLabelDelete: (labelId: string) => void; }; const defaultValues: Partial = { name: "", colour: "#ff0000", }; const SingleLabel: React.FC = ({ label, issueLabels, editLabel, handleLabelDelete }) => { const [newLabelForm, setNewLabelForm] = useState(true); const { register, handleSubmit, formState: { errors, isSubmitting }, setError, watch, reset, 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("colour") && watch("colour") !== "" && ( )} ( onChange(value.hex)} /> )} /> )}
) : (

This is the label group title

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