From 06474f9e8e395efdb0e593d5c216eafeb75cdc94 Mon Sep 17 00:00:00 2001 From: Matthias Nannt Date: Fri, 25 Aug 2023 11:54:38 +0200 Subject: [PATCH] fix blog page not loading properly --- .../components/docs/Heading.tsx | 46 +++++++++++++++++-- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/apps/formbricks-com/components/docs/Heading.tsx b/apps/formbricks-com/components/docs/Heading.tsx index 02c93e7c3c..ce1a44bacc 100644 --- a/apps/formbricks-com/components/docs/Heading.tsx +++ b/apps/formbricks-com/components/docs/Heading.tsx @@ -1,12 +1,13 @@ "use client"; -import { useEffect, useRef } from "react"; -import Link from "next/link"; import { useInView } from "framer-motion"; +import Link from "next/link"; +import { useEffect, useRef } from "react"; +import { remToPx } from "@/lib/remToPx"; import { useSectionStore } from "./SectionProvider"; import { Tag } from "./Tag"; -import { remToPx } from "@/lib/remToPx"; +import { usePathname } from "next/navigation"; function AnchorIcon(props: React.ComponentPropsWithoutRef<"svg">) { return ( @@ -45,7 +46,7 @@ function Anchor({ id, inView, children }: { id: string; inView: boolean; childre ); } -export function Heading({ +export function HeadingDocs({ children, tag, label, @@ -90,3 +91,40 @@ export function Heading({ ); } + +export function HeadingContent({ + children, + tag, + label, + level, + anchor = true, + ...props +}: React.ComponentPropsWithoutRef<`h${Level}`> & { + id: string; + tag?: string; + label?: string; + level?: Level; + anchor?: boolean; +}) { + level = level ?? (2 as Level); + let Component = `h${level}` as "h2" | "h3"; + let ref = useRef(null); + + return ( + <> + + + {children} + + + ); +} + +export function Heading(props: any) { + const pathname = usePathname(); + if (pathname?.startsWith("/docs")) { + return ; + } else { + return ; + } +}