From bfc72170c572afe9a47a34af777d98e6fa1af768 Mon Sep 17 00:00:00 2001
From: sumit_chaturvedi
Date: Mon, 7 Jul 2025 10:19:50 +0530
Subject: [PATCH] feat(ui): create CustomLink component decoupled from
CustomButton
---
.../compliance/no-scans-available.tsx | 10 +-
.../findings/table/delta-indicator.tsx | 11 +-
.../invitations/invitation-details.tsx | 10 +-
.../invitations/send-invitation-button.tsx | 10 +-
.../manage-groups/manage-groups-button.tsx | 12 +-
.../link-to-findings/link-to-findings.tsx | 9 +-
.../provider-overview/provider-overview.tsx | 9 +-
.../providers/add-provider-button.tsx | 10 +-
ui/components/providers/link-to-scans.tsx | 9 +-
.../workflow/credentials-role-helper.tsx | 20 +--
ui/components/roles/add-role-button.tsx | 10 +-
.../scans/link-to-findings-from-scan.tsx | 13 +-
ui/components/scans/no-providers-added.tsx | 10 +-
.../scans/no-providers-connected.tsx | 10 +-
ui/components/ui/custom/custom-button.tsx | 5 -
ui/components/ui/custom/custom-link.tsx | 124 ++++++++++++++++++
ui/components/ui/custom/index.ts | 1 +
.../ui/headers/navigation-header.tsx | 14 +-
ui/components/ui/sidebar/menu.tsx | 15 ++-
ui/components/users/add-user-button.tsx | 10 +-
20 files changed, 218 insertions(+), 104 deletions(-)
create mode 100644 ui/components/ui/custom/custom-link.tsx
diff --git a/ui/components/compliance/no-scans-available.tsx b/ui/components/compliance/no-scans-available.tsx
index 6089bfd846..f8a8f66a75 100644
--- a/ui/components/compliance/no-scans-available.tsx
+++ b/ui/components/compliance/no-scans-available.tsx
@@ -2,8 +2,9 @@
import React from "react";
+import { CustomLink } from "@/components/ui/custom";
+
import { InfoIcon } from "../icons/Icons";
-import { CustomButton } from "../ui/custom";
export const NoScansAvailable = () => {
return (
@@ -23,16 +24,15 @@ export const NoScansAvailable = () => {
-
Go to Scans
-
+
diff --git a/ui/components/findings/table/delta-indicator.tsx b/ui/components/findings/table/delta-indicator.tsx
index 86f89b02a6..4e1a023b99 100644
--- a/ui/components/findings/table/delta-indicator.tsx
+++ b/ui/components/findings/table/delta-indicator.tsx
@@ -1,6 +1,6 @@
import { Tooltip } from "@nextui-org/react";
-import { CustomButton } from "@/components/ui/custom/custom-button";
+import { CustomLink } from "@/components/ui/custom";
import { cn } from "@/lib/utils";
interface DeltaIndicatorProps {
@@ -18,16 +18,15 @@ export const DeltaIndicator = ({ delta }: DeltaIndicatorProps) => {
? "New finding."
: "Status changed since the previous scan."}
-
Learn more
-
+
}
>
diff --git a/ui/components/invitations/invitation-details.tsx b/ui/components/invitations/invitation-details.tsx
index f91aef5f19..38f68aafc3 100644
--- a/ui/components/invitations/invitation-details.tsx
+++ b/ui/components/invitations/invitation-details.tsx
@@ -2,8 +2,9 @@
import { Card, CardBody, Divider, Snippet } from "@nextui-org/react";
+import { CustomLink } from "@/components/ui/custom";
+
import { AddIcon } from "../icons";
-import { CustomButton } from "../ui/custom";
import { DateWithTime } from "../ui/entities";
interface InvitationDetailsProps {
@@ -108,16 +109,15 @@ export const InvitationDetails = ({ attributes }: InvitationDetailsProps) => {
- }
>
Back to Invitations
-
+
);
diff --git a/ui/components/invitations/send-invitation-button.tsx b/ui/components/invitations/send-invitation-button.tsx
index ae13d33b1d..dc41181e76 100644
--- a/ui/components/invitations/send-invitation-button.tsx
+++ b/ui/components/invitations/send-invitation-button.tsx
@@ -1,21 +1,21 @@
"use client";
+import { CustomLink } from "@/components/ui/custom";
+
import { AddIcon } from "../icons";
-import { CustomButton } from "../ui/custom";
export const SendInvitationButton = () => {
return (
- }
>
Send Invitation
-
+
);
};
diff --git a/ui/components/manage-groups/manage-groups-button.tsx b/ui/components/manage-groups/manage-groups-button.tsx
index 7bfc0cdc0d..5c70eb4d8b 100644
--- a/ui/components/manage-groups/manage-groups-button.tsx
+++ b/ui/components/manage-groups/manage-groups-button.tsx
@@ -2,19 +2,19 @@
import { SettingsIcon } from "lucide-react";
-import { CustomButton } from "../ui/custom";
+import { CustomLink } from "@/components/ui/custom";
export const ManageGroupsButton = () => {
return (
- }
>
Manage Groups
-
+
);
};
diff --git a/ui/components/overview/new-findings-table/link-to-findings/link-to-findings.tsx b/ui/components/overview/new-findings-table/link-to-findings/link-to-findings.tsx
index e5766db634..aa07772c61 100644
--- a/ui/components/overview/new-findings-table/link-to-findings/link-to-findings.tsx
+++ b/ui/components/overview/new-findings-table/link-to-findings/link-to-findings.tsx
@@ -1,19 +1,18 @@
"use client";
-import { CustomButton } from "@/components/ui/custom";
+import { CustomLink } from "@/components/ui/custom";
export const LinkToFindings = () => {
return (
-
Check out on Findings
-
+
);
};
diff --git a/ui/components/overview/provider-overview/provider-overview.tsx b/ui/components/overview/provider-overview/provider-overview.tsx
index 41d518eb8a..200858c1ba 100644
--- a/ui/components/overview/provider-overview/provider-overview.tsx
+++ b/ui/components/overview/provider-overview/provider-overview.tsx
@@ -10,7 +10,7 @@ import {
KS8ProviderBadge,
M365ProviderBadge,
} from "@/components/icons/providers-badge";
-import { CustomButton } from "@/components/ui/custom/custom-button";
+import { CustomLink } from "@/components/ui/custom";
import { ProviderOverviewProps } from "@/types";
export const ProvidersOverview = ({
@@ -178,16 +178,15 @@ export const ProvidersOverview = ({
- }
>
Add Provider
-
+
diff --git a/ui/components/providers/add-provider-button.tsx b/ui/components/providers/add-provider-button.tsx
index 24b1b54c86..8a7cc45fd9 100644
--- a/ui/components/providers/add-provider-button.tsx
+++ b/ui/components/providers/add-provider-button.tsx
@@ -1,19 +1,19 @@
"use client";
+import { CustomLink } from "@/components/ui/custom";
+
import { AddIcon } from "../icons";
-import { CustomButton } from "../ui/custom";
export const AddProviderButton = () => {
return (
- }
>
Add Cloud Provider
-
+
);
};
diff --git a/ui/components/providers/link-to-scans.tsx b/ui/components/providers/link-to-scans.tsx
index bcd694cbe0..6630298fb5 100644
--- a/ui/components/providers/link-to-scans.tsx
+++ b/ui/components/providers/link-to-scans.tsx
@@ -1,6 +1,6 @@
"use client";
-import { CustomButton } from "@/components/ui/custom";
+import { CustomLink } from "@/components/ui/custom";
interface LinkToScansProps {
providerUid?: string;
@@ -8,14 +8,13 @@ interface LinkToScansProps {
export const LinkToScans = ({ providerUid }: LinkToScansProps) => {
return (
-
View Scan Jobs
-
+
);
};
diff --git a/ui/components/providers/workflow/credentials-role-helper.tsx b/ui/components/providers/workflow/credentials-role-helper.tsx
index 855a3e6fab..1716ad47a0 100644
--- a/ui/components/providers/workflow/credentials-role-helper.tsx
+++ b/ui/components/providers/workflow/credentials-role-helper.tsx
@@ -3,7 +3,7 @@
import { Snippet } from "@nextui-org/react";
import { useSession } from "next-auth/react";
-import { CustomButton } from "@/components/ui/custom";
+import { CustomLink } from "@/components/ui/custom";
import { getAWSCredentialsTemplateLinks } from "@/lib";
export const CredentialsRoleHelper = () => {
@@ -16,15 +16,15 @@ export const CredentialsRoleHelper = () => {
A new read-only IAM role must be manually created.
-
Use the following AWS CloudFormation Quick Link to deploy the IAM Role
-
+
@@ -38,24 +38,24 @@ export const CredentialsRoleHelper = () => {
-
CloudFormation Template
-
-
+
Terraform Code
-
+
diff --git a/ui/components/roles/add-role-button.tsx b/ui/components/roles/add-role-button.tsx
index 3ac3b67126..05c8e5369b 100644
--- a/ui/components/roles/add-role-button.tsx
+++ b/ui/components/roles/add-role-button.tsx
@@ -1,21 +1,21 @@
"use client";
+import { CustomLink } from "@/components/ui/custom";
+
import { AddIcon } from "../icons";
-import { CustomButton } from "../ui/custom";
export const AddRoleButton = () => {
return (
- }
>
Add Role
-
+
);
};
diff --git a/ui/components/scans/link-to-findings-from-scan.tsx b/ui/components/scans/link-to-findings-from-scan.tsx
index 6f94773cee..2b55405983 100644
--- a/ui/components/scans/link-to-findings-from-scan.tsx
+++ b/ui/components/scans/link-to-findings-from-scan.tsx
@@ -1,6 +1,6 @@
"use client";
-import { CustomButton } from "@/components/ui/custom";
+import { CustomLink } from "@/components/ui/custom";
interface LinkToFindingsProps {
scanId?: string;
@@ -12,15 +12,14 @@ export const LinkToFindingsFromScan = ({
isDisabled,
}: LinkToFindingsProps) => {
return (
-
See Findings
-
+
);
};
diff --git a/ui/components/scans/no-providers-added.tsx b/ui/components/scans/no-providers-added.tsx
index 5abc68a0ab..f0bafe5ac4 100644
--- a/ui/components/scans/no-providers-added.tsx
+++ b/ui/components/scans/no-providers-added.tsx
@@ -3,8 +3,9 @@
import { Card, CardBody } from "@nextui-org/react";
import React from "react";
+import { CustomLink } from "@/components/ui/custom";
+
import { InfoIcon } from "../icons/Icons";
-import { CustomButton } from "../ui/custom";
export const NoProvidersAdded = () => {
return (
@@ -25,16 +26,15 @@ export const NoProvidersAdded = () => {
-
Get Started
-
+
diff --git a/ui/components/scans/no-providers-connected.tsx b/ui/components/scans/no-providers-connected.tsx
index 96acb15e15..4a9f32e13b 100644
--- a/ui/components/scans/no-providers-connected.tsx
+++ b/ui/components/scans/no-providers-connected.tsx
@@ -2,8 +2,9 @@
import React from "react";
+import { CustomLink } from "@/components/ui/custom";
+
import { InfoIcon } from "../icons/Icons";
-import { CustomButton } from "../ui/custom";
export const NoProvidersConnected = () => {
return (
@@ -26,16 +27,15 @@ export const NoProvidersConnected = () => {
-
Review Cloud Providers
-
+
diff --git a/ui/components/ui/custom/custom-button.tsx b/ui/components/ui/custom/custom-button.tsx
index ed8db8ef4d..bc5c649000 100644
--- a/ui/components/ui/custom/custom-button.tsx
+++ b/ui/components/ui/custom/custom-button.tsx
@@ -1,7 +1,6 @@
import { Button, CircularProgress } from "@nextui-org/react";
import type { PressEvent } from "@react-types/shared";
import clsx from "clsx";
-import Link from "next/link";
import React from "react";
import { NextUIColors, NextUIVariants } from "@/types";
@@ -53,7 +52,6 @@ interface CustomButtonProps {
isLoading?: boolean;
isIconOnly?: boolean;
ref?: React.RefObject;
- asLink?: string;
}
export const CustomButton = React.forwardRef<
@@ -78,14 +76,11 @@ export const CustomButton = React.forwardRef<
isDisabled = false,
isLoading = false,
isIconOnly,
- asLink,
...props
},
ref,
) => (