From 3921e4c4785472f126e78b6039073a809c9770e6 Mon Sep 17 00:00:00 2001 From: Mikael Brevik Date: Thu, 12 Dec 2024 20:30:55 +0100 Subject: [PATCH] fix: shorten links --- .../customerCase/projectInfo/CustomerCaseProjectInfo.tsx | 6 +++++- .../projectInfo/customerCaseProjectInfo.module.css | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/customerCases/customerCase/projectInfo/CustomerCaseProjectInfo.tsx b/src/components/customerCases/customerCase/projectInfo/CustomerCaseProjectInfo.tsx index db084dadb..266fadff6 100644 --- a/src/components/customerCases/customerCase/projectInfo/CustomerCaseProjectInfo.tsx +++ b/src/components/customerCases/customerCase/projectInfo/CustomerCaseProjectInfo.tsx @@ -104,7 +104,7 @@ export default async function CustomerCaseProjectInfo({ _key: "go-to-external-link", _type: "link", linkType: LinkType.External, - linkTitle: projectInfo.url, + linkTitle: shortenUrl(projectInfo.url), url: projectInfo.url, ariaLabel: projectInfo.url, }} @@ -175,3 +175,7 @@ export default async function CustomerCaseProjectInfo({ ); } + +function shortenUrl(url: string) { + return url.replace(/^https?:\/\/(www\.)?/, ""); +} diff --git a/src/components/customerCases/customerCase/projectInfo/customerCaseProjectInfo.module.css b/src/components/customerCases/customerCase/projectInfo/customerCaseProjectInfo.module.css index 5bf885637..6ca3e25dd 100644 --- a/src/components/customerCases/customerCase/projectInfo/customerCaseProjectInfo.module.css +++ b/src/components/customerCases/customerCase/projectInfo/customerCaseProjectInfo.module.css @@ -85,4 +85,5 @@ display: flex; flex-direction: column; gap: 0.25rem; + overflow: hidden; }