From 3f8ae3f558446aba3870e90c899db25ad9321499 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Tue, 24 Oct 2023 18:48:57 +0200
Subject: refactor(components): rewrite Pagination component

---
 .../atoms/buttons/button-link/button-link.tsx           | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

(limited to 'src/components/atoms/buttons/button-link/button-link.tsx')

diff --git a/src/components/atoms/buttons/button-link/button-link.tsx b/src/components/atoms/buttons/button-link/button-link.tsx
index 96f5d3e..9ac3853 100644
--- a/src/components/atoms/buttons/button-link/button-link.tsx
+++ b/src/components/atoms/buttons/button-link/button-link.tsx
@@ -10,6 +10,14 @@ export type ButtonLinkProps = Omit<
    * The button link body.
    */
   children: ReactNode;
+  /**
+   * Should the link be disabled?
+   *
+   * Be aware, if disable the link will be replaced by a `span` element.
+   *
+   * @default false
+   */
+  isDisabled?: boolean;
   /**
    * True if it is an external link.
    *
@@ -44,6 +52,7 @@ export const ButtonLink: FC<ButtonLinkProps> = ({
   className = '',
   kind = 'secondary',
   shape = 'rectangle',
+  isDisabled = false,
   isExternal = false,
   rel = '',
   to,
@@ -52,6 +61,14 @@ export const ButtonLink: FC<ButtonLinkProps> = ({
   const kindClass = styles[`btn--${kind}`];
   const shapeClass = styles[`btn--${shape}`];
   const btnClass = `${styles.btn} ${kindClass} ${shapeClass} ${className}`;
+
+  if (isDisabled)
+    return (
+      <span {...props} className={btnClass} data-disabled>
+        {children}
+      </span>
+    );
+
   const linkRel =
     isExternal && !rel.includes('external') ? `external ${rel}` : rel;
 
-- 
cgit v1.2.3

