File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,13 @@ import cn from 'clsx'
55import NextLink from 'next/link'
66import type { ComponentProps , CSSProperties , ReactNode } from 'react'
77
8+ function CardLink ( { href, children, ...props } : { href : string ; children : ReactNode ; className ?: string ; [ key : string ] : any } ) {
9+ if ( href . startsWith ( 'mailto:' ) || href . startsWith ( 'tel:' ) ) {
10+ return < a href = { href } { ...props } > { children } </ a >
11+ }
12+ return < NextLink href = { href } { ...props } > { children } </ NextLink >
13+ }
14+
815const classes = {
916 cards : cn (
1017 'nextra-cards x:mt-4 x:gap-4 x:grid' ,
@@ -50,7 +57,7 @@ export function Card({
5057
5158 if ( image ) {
5259 return (
53- < NextLink
60+ < CardLink
5461 href = { href }
5562 className = { cn (
5663 classes . card ,
@@ -71,12 +78,12 @@ export function Card({
7178 { animatedArrow }
7279 </ span >
7380 </ span >
74- </ NextLink >
81+ </ CardLink >
7582 )
7683 }
7784
7885 return (
79- < NextLink
86+ < CardLink
8087 href = { href }
8188 className = { cn (
8289 classes . card ,
@@ -95,7 +102,7 @@ export function Card({
95102 < span className = "x:block x:-mt-1 x:opacity-60 x:text-sm x:text-left" > { description } </ span >
96103 { animatedArrow }
97104 </ span >
98- </ NextLink >
105+ </ CardLink >
99106 )
100107}
101108
You can’t perform that action at this time.
0 commit comments