From 244560cfac426bac42f2dcacb4abc8f815e0ddc8 Mon Sep 17 00:00:00 2001 From: Christian Andolf Date: Tue, 29 Apr 2025 11:22:48 +0200 Subject: [PATCH] fix: use link component for all types of links to add proper styling to set text decoration none when external --- .../components/ContentCard/contentCard.ts | 7 ----- .../components/ContentCard/index.tsx | 29 +++++-------------- 2 files changed, 7 insertions(+), 29 deletions(-) diff --git a/apps/scandic-web/components/ContentCard/contentCard.ts b/apps/scandic-web/components/ContentCard/contentCard.ts index b18ebf0e4..3c40c5cbc 100644 --- a/apps/scandic-web/components/ContentCard/contentCard.ts +++ b/apps/scandic-web/components/ContentCard/contentCard.ts @@ -12,10 +12,3 @@ export interface ContentCardProps { promoText?: string className?: string } - -export interface ContentCardLinkProps { - href: string - openInNewTab?: boolean - isExternal?: boolean - children: React.ReactNode -} diff --git a/apps/scandic-web/components/ContentCard/index.tsx b/apps/scandic-web/components/ContentCard/index.tsx index b67842a58..a77bc66f8 100644 --- a/apps/scandic-web/components/ContentCard/index.tsx +++ b/apps/scandic-web/components/ContentCard/index.tsx @@ -6,7 +6,7 @@ import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import styles from "./contentCard.module.css" -import type { ContentCardLinkProps, ContentCardProps } from "./contentCard" +import type { ContentCardProps } from "./contentCard" export default function ContentCard({ heading, @@ -40,31 +40,16 @@ export default function ContentCard({ if (!link) return card - return ( - - {card} - - ) -} - -function ContentCardLink({ - children, - href, - openInNewTab, - isExternal, -}: ContentCardLinkProps) { - const Component = isExternal ? "a" : Link const linkProps = { - href, - ...(openInNewTab && { + ...(link.openInNewTab && { target: "_blank", rel: "noopener noreferrer", }), } - return {children} + return ( + + {card} + + ) }