diff --git a/web/components/issues/issue-detail/label/create-label.tsx b/web/components/issues/issue-detail/label/create-label.tsx index 160ff0071..de376ce79 100644 --- a/web/components/issues/issue-detail/label/create-label.tsx +++ b/web/components/issues/issue-detail/label/create-label.tsx @@ -1,14 +1,13 @@ import { FC, useState, Fragment, useEffect } from "react"; import { TwitterPicker } from "react-color"; import { Controller, useForm } from "react-hook-form"; +import { usePopper } from "react-popper"; import { Plus, X, Loader } from "lucide-react"; -import { Popover, Transition } from "@headlessui/react"; +import { Popover } from "@headlessui/react"; import { IIssueLabel } from "@plane/types"; // hooks import { Input, TOAST_TYPE, setToast } from "@plane/ui"; import { useIssueDetail } from "@/hooks/store"; -// helpers -import { cn } from "helpers/common.helper"; // ui // types import { TLabelOperations } from "./root"; @@ -31,11 +30,12 @@ export const LabelCreate: FC = (props) => { // hooks const { issue: { getIssueById }, - peekIssue, } = useIssueDetail(); // state const [isCreateToggle, setIsCreateToggle] = useState(false); const handleIsCreateToggle = () => setIsCreateToggle(!isCreateToggle); + const [referenceElement, setReferenceElement] = useState(null); + const [popperElement, setPopperElement] = useState(null); // react hook form const { handleSubmit, @@ -47,6 +47,18 @@ export const LabelCreate: FC = (props) => { defaultValues, }); + const { styles, attributes } = usePopper(referenceElement, popperElement, { + placement: "bottom-start", + modifiers: [ + { + name: "preventOverflow", + options: { + padding: 12, + }, + }, + ], + }); + useEffect(() => { if (!isCreateToggle) return; @@ -93,36 +105,28 @@ export const LabelCreate: FC = (props) => { render={({ field: { value, onChange } }) => ( <> - - {value && value?.trim() !== "" && ( - - )} + + - - - +
- onChange(value.hex)} - /> - - + onChange(value.hex)} /> +
+
)}