Skip to content

Commit

Permalink
fix(): Optional next link config via props.
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanCQ committed Oct 7, 2024
1 parent de8e3c3 commit 93609fa
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/custom/docs/components/triplecard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Card, CardTitle, CardSubtitle } from './Card'
import NextImage from 'next/image'
import NextLink from 'next/link'
import { z } from 'zod'
import { ComponentProps } from 'react'

Expand All @@ -22,8 +23,8 @@ const cardSchema = z.array(

const regularLink = (props: ComponentProps<'a'>) => <a {...props}></a>

export const TripleCard = (props: {cards: z.infer<typeof cardSchema>, imageComponent: typeof NextImage | typeof regularLink }) => {

export const TripleCard = (props: {cards: z.infer<typeof cardSchema>, imageComponent: typeof NextImage | typeof regularLink, useNextLink?: boolean }) => {
const LinkComponent = props.useNextLink ? NextLink : (props: ComponentProps<'a'>) => <a {...props}></a>
return (
<section className="shadow-lg rounded-xl grid grid-cols-1 items-stretch md:grid-cols-3 ">
{props.cards.map((item, idx, arr) => {
Expand Down Expand Up @@ -65,12 +66,12 @@ export const TripleCard = (props: {cards: z.infer<typeof cardSchema>, imageCompo
return (
<li key={link.title}>

<a
<LinkComponent
className="font-semibold tracking-tight text-blue-600 dark:text-blue-300"
href={link.link}
>
{link.title}
</a>
</LinkComponent>
<div className="my-2"></div>
<div className="text-muted-foreground text-xs leading-4">
{link.description}
Expand Down

0 comments on commit 93609fa

Please sign in to comment.