From eb55421eccf8d6c0501de8bd24e0a841aaa8c029 Mon Sep 17 00:00:00 2001 From: Krish Rakesh Dave <116882111+KrishDave1@users.noreply.github.com> Date: Thu, 24 Oct 2024 12:51:04 +0530 Subject: [PATCH] fix:Clickable Links and Responsive Badges (#1565) --- src/common/badges-dashboard/Badge.jsx | 11 ++++++----- src/common/badges-dashboard/BadgeDetails.jsx | 12 +++++++++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/common/badges-dashboard/Badge.jsx b/src/common/badges-dashboard/Badge.jsx index c655353915..fd956a2a02 100644 --- a/src/common/badges-dashboard/Badge.jsx +++ b/src/common/badges-dashboard/Badge.jsx @@ -11,7 +11,7 @@ const Badge = ({ badge, selectionChanged, readonly = false, showtext = true }) = /> ) : ( -
+
@@ -20,8 +20,8 @@ const Badge = ({ badge, selectionChanged, readonly = false, showtext = true }) = class="relative px-2 py-4 rounded-lg leading-none flex items-center divide-x divide-gray-600 w-full transition duration-1000 group-hover:shadow-md group-hover:drop-shadow-xl" onClick={() => selectionChanged()} > -
-
+
+
- - {showtext &&
{badge.level}
} +
+ {showtext &&
{badge.level}
} +
diff --git a/src/common/badges-dashboard/BadgeDetails.jsx b/src/common/badges-dashboard/BadgeDetails.jsx index bff5e9fe1e..893bf60b19 100644 --- a/src/common/badges-dashboard/BadgeDetails.jsx +++ b/src/common/badges-dashboard/BadgeDetails.jsx @@ -2,6 +2,16 @@ import Badge from './Badge'; import './badge.css'; const BadgeDetails = ({ badge, onClose }) => { + const makeClickableLinks = (badge) => { + const linkPattern = /(\w+)\s?\((https?:\/\/[^)]+)\)/g; + + const descriptionWithLinks = badge.description.replace(linkPattern, (match, name, url) => { + return `${name}`; + }); + + return ; + }; + return (

- {badge.description} + {makeClickableLinks(badge)}