From bbe82309129a34e1c4ed3c7d455382a6205768c0 Mon Sep 17 00:00:00 2001 From: kbinreallife <141305609+kbinreallife@users.noreply.github.com> Date: Sun, 26 May 2024 04:29:47 +0000 Subject: [PATCH] make percipo badges clickable links to verification --- src/app/page.js | 90 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 62 insertions(+), 28 deletions(-) diff --git a/src/app/page.js b/src/app/page.js index 4127297..0d36d47 100644 --- a/src/app/page.js +++ b/src/app/page.js @@ -11,18 +11,14 @@ export { DynamicHome }; export default function Home() { const [showSection, setShowSection] = useState(null); const outsideClickListener = useRef(null); - - // Function to toggle the visibility of the section based on the link clicked const toggleSection = (section) => { setShowSection(showSection === section ? null : section); }; - // Function to hide all sections when clicking anywhere on the screen that is not a link const hideAllSections = () => { setShowSection(null); }; - // Effect to add a global click event listener to hide sections when clicking outside the links useEffect(() => { outsideClickListener.current = (event) => { if (!event.target.closest('.nav-link')) { @@ -35,7 +31,6 @@ export default function Home() { }; }, []); - // Function to add click event listener to the links when they are clicked const handleClickLink = (section) => { return (event) => { event.stopPropagation(); @@ -44,20 +39,59 @@ export default function Home() { }; const badges = [ - 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/104579180', - 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/104554484', - 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/104434982', - 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/104338603', - 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/104338603', - 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/104066782', - 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/104066782', - 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/104024819', - 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/103848058', - 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/92312569', - 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/84649053', - 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/84040776', - 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/37169657' - ] + { + imageUrl: 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/104579180', + linkUrl: 'https://www.credential.net/104579180', + }, + { + imageUrl: 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/104554484', + linkUrl: 'https://www.credential.net/104554484', + }, + { + imageUrl: 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/104434982', + linkUrl: 'https://www.credential.net/104434982', + }, + { + imageUrl: 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/104338603', + linkUrl: 'https://www.credential.net/104338603', + }, + { + imageUrl: 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/104338603', + linkUrl: 'https://www.credential.net/104338603', + }, + { + imageUrl: 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/104066782', + linkUrl: 'https://www.credential.net/104066782', + }, + { + imageUrl: 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/104066782', + linkUrl: 'https://www.credential.net/104066782', + }, + { + imageUrl: 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/104024819', + linkUrl: 'https://www.credential.net/104024819', + }, + { + imageUrl: 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/103848058', + linkUrl: 'https://www.credential.net/103848058', + }, + { + imageUrl: 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/92312569', + linkUrl: 'https://www.credential.net/92312569', + }, + { + imageUrl: 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/84649053', + linkUrl: 'https://www.credential.net/84649053', + }, + { + imageUrl: 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/84040776', + linkUrl: 'https://www.credential.net/84040776', + }, + { + imageUrl: 'https://api.accredible.com/v1/frontend/credential_website_embed_image/badge/37169657', + linkUrl: 'https://www.credential.net/37169657', + }, + ]; return (