From 3a5de791154e21f08608d655a851674308012ab8 Mon Sep 17 00:00:00 2001 From: r-freeman Date: Thu, 19 Sep 2024 16:00:03 +0100 Subject: [PATCH] Fix ts issue --- components/ui/Heading.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/components/ui/Heading.tsx b/components/ui/Heading.tsx index 4537d8a..e076bba 100644 --- a/components/ui/Heading.tsx +++ b/components/ui/Heading.tsx @@ -1,4 +1,3 @@ -// @ts-nocheck import {ElementType, ReactNode} from 'react' import {createSlug} from '@/lib/createSlug' import Link from 'next/link' @@ -8,12 +7,14 @@ type HeadingProps = { children: ReactNode } -export function Heading({as: Component = 'h1', children}: HeadingProps) { +export function Heading({as: Component = 'h1', children = null}: HeadingProps) { + let headingText = children ? children.toString() : '' + return ( - + {children} # + href={`#${createSlug(headingText)}`}># ) } \ No newline at end of file