From d5f718c6ad2dbc60e6bbf4a556bb284e1c9b751a Mon Sep 17 00:00:00 2001 From: Scott Wilson Date: Fri, 8 Nov 2024 14:07:50 -0800 Subject: [PATCH] improve: improve template form buttons --- .../components/EditProjectTemplate.tsx | 103 +++++++----------- .../ProjectTemplateEnvironmentsForm.tsx | 14 +-- 2 files changed, 46 insertions(+), 71 deletions(-) diff --git a/frontend/src/views/Settings/OrgSettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/EditProjectTemplate.tsx b/frontend/src/views/Settings/OrgSettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/EditProjectTemplate.tsx index d6b6e0d68..6aebb3ca3 100644 --- a/frontend/src/views/Settings/OrgSettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/EditProjectTemplate.tsx +++ b/frontend/src/views/Settings/OrgSettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/EditProjectTemplate.tsx @@ -1,17 +1,9 @@ -import { faEllipsis } from "@fortawesome/free-solid-svg-icons"; +import { faPencil, faTrash } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { twMerge } from "tailwind-merge"; import { createNotification } from "@app/components/notifications"; import { OrgPermissionCan } from "@app/components/permissions"; -import { - DeleteActionModal, - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, - IconButton -} from "@app/components/v2"; +import { Button, DeleteActionModal } from "@app/components/v2"; import { OrgPermissionActions, OrgPermissionSubjects } from "@app/context"; import { usePopUp } from "@app/hooks"; import { TProjectTemplate, useDeleteProjectTemplate } from "@app/hooks/api/projectTemplates"; @@ -58,63 +50,48 @@ export const EditProjectTemplate = ({ isInfisicalTemplate, projectTemplate, onBa return ( <> -
-
+
+

{name}

{description || "Project Template"}

{!isInfisicalTemplate && ( - - - - - - - - - {(isAllowed) => ( - handlePopUpOpen("editDetails")} - disabled={!isAllowed} - > - Edit Details - - )} - - - {(isAllowed) => ( - { - handlePopUpOpen("removeTemplate"); - }} - disabled={!isAllowed} - > - Delete Template - - )} - - - +
+ + {(isAllowed) => ( + + )} + + + {(isAllowed) => ( + + )} + +
)}
{(isAllowed) => ( - append({ name: "", slug: "" })} - colorSchema="primary" + colorSchema="secondary" className="ml-auto" - variant="outline_bg" + variant="solid" size="xs" - ariaLabel="Add environment" + leftIcon={} isDisabled={!isAllowed} > - - + Add Environment + )}