diff --git a/src/app/components/Resume/ResumePDF/ResumePDFProfile.tsx b/src/app/components/Resume/ResumePDF/ResumePDFProfile.tsx index d697f03..a01f522 100644 --- a/src/app/components/Resume/ResumePDF/ResumePDFProfile.tsx +++ b/src/app/components/Resume/ResumePDF/ResumePDFProfile.tsx @@ -56,34 +56,23 @@ export const ResumePDFProfile = ({ const Wrapper = ({ children }: { children: React.ReactNode }) => { if (!shouldUseLinkWrapper) return <>{children}; - let urlSrc = ""; - + let src = ""; switch (key) { - case "email": - urlSrc = `mailto:${value}`; + case "email": { + src = `mailto:${value}`; break; - - case "phone": - urlSrc = `tel:${value.replace(/[^\d+]/g, "")}`; - break; - - case "url": - let removalCases = ["http://", "https://"]; - let http_protocol = "https://"; - - removalCases.forEach((item) => { - if (value.startsWith(item)) { - value = value.substring(item.length - 1, value.length - 1); - http_protocol = item; - } - }); - - urlSrc = `${http_protocol}${value}`; + } + case "phone": { + src = `tel:${value.replace(/[^\d+]/g, "")}`; // Keep only + and digits break; + } + default: { + src = value.startsWith("http") ? value : `https://${value}`; + } } return ( - + {children} );