From ddeafc069575ac48c4c99e86a2f9ea49a8b541f1 Mon Sep 17 00:00:00 2001 From: Dakshesh Jain <65905942+dakshesh14@users.noreply.github.com> Date: Fri, 19 May 2023 19:12:24 +0530 Subject: [PATCH] fix: inconsistency for create label, select label getting closed on select (#1085) --- .../components/labels/create-label-modal.tsx | 9 +-- .../labels/create-update-label-inline.tsx | 14 +++- .../projects/[projectId]/pages/[pageId].tsx | 78 ++++++++----------- 3 files changed, 46 insertions(+), 55 deletions(-) diff --git a/apps/app/components/labels/create-label-modal.tsx b/apps/app/components/labels/create-label-modal.tsx index c186cbd7c..3f1b4d647 100644 --- a/apps/app/components/labels/create-label-modal.tsx +++ b/apps/app/components/labels/create-label-modal.tsx @@ -30,7 +30,7 @@ type Props = { const defaultValues: Partial = { name: "", - color: "#000000", + color: "#858E96", }; export const CreateLabelModal: React.FC = ({ isOpen, projectId, handleClose }) => { @@ -44,7 +44,6 @@ export const CreateLabelModal: React.FC = ({ isOpen, projectId, handleClo watch, control, reset, - setError, } = useForm({ defaultValues, }); @@ -109,13 +108,13 @@ export const CreateLabelModal: React.FC = ({ isOpen, projectId, handleClo {({ open, close }) => ( <> {watch("color") && watch("color") !== "" && ( = ({ isOpen, projectId, handleClo type="text" id="name" name="name" - placeholder="Enter name" + placeholder="Label title" autoComplete="off" error={errors.name} register={register} diff --git a/apps/app/components/labels/create-update-label-inline.tsx b/apps/app/components/labels/create-update-label-inline.tsx index 6fe2d2495..7010d564e 100644 --- a/apps/app/components/labels/create-update-label-inline.tsx +++ b/apps/app/components/labels/create-update-label-inline.tsx @@ -14,6 +14,8 @@ import { Popover, Transition } from "@headlessui/react"; import issuesService from "services/issues.service"; // ui import { Input, PrimaryButton, SecondaryButton } from "components/ui"; +// icons +import { ChevronDownIcon } from "@heroicons/react/24/outline"; // types import { IIssueLabels } from "types"; // fetch-keys @@ -28,7 +30,7 @@ type Props = { const defaultValues: Partial = { name: "", - color: "#ff0000", + color: "#858E96", }; type Ref = HTMLDivElement; @@ -113,7 +115,7 @@ export const CreateUpdateLabelInline = forwardRef(function CreateUpd }`} ref={ref} > -
+
{({ open }) => ( <> @@ -128,6 +130,12 @@ export const CreateUpdateLabelInline = forwardRef(function CreateUpd backgroundColor: watch("color"), }} /> +
-
+
{
- {pageDetails.labels.length > 0 ? ( + {pageDetails.labels.length > 0 && ( <> {pageDetails.labels.map((labelId) => { const label = labels?.find((label) => label.id === labelId); @@ -362,54 +362,38 @@ const SinglePage: NextPage = () => {
); })} - - - - } - value={pageDetails.labels} - onChange={(val: string[]) => partialUpdatePage({ labels_list: val })} - options={options} - multiple - noChevron - /> - ) : ( - - - Add label - - } - value={pageDetails.labels} - onChange={(val: string[]) => partialUpdatePage({ labels_list: val })} - footerOption={ - - } - options={options} - multiple - noChevron - /> )} + + + {pageDetails.labels.length <= 0 && Add Label} + + } + value={pageDetails.labels} + footerOption={ + + } + onChange={(val: string[]) => partialUpdatePage({ labels_list: val })} + options={options} + multiple + noChevron + />