Skip to content

Commit 02cadb5

Browse files
committed
blog: fix nested <p> hydration warning in BlogInlineCTA
Collapse the component's outer <p> into its <div className="not-prose">. MDX was wrapping the component's children in a <p>, which landed inside the <a>, producing a <p>-inside-<p> hydration error. The typography classes move to the <div> with no visual change.
1 parent 986bc62 commit 02cadb5

1 file changed

Lines changed: 16 additions & 18 deletions

File tree

components/blog/inline-cta.tsx

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,23 @@ export function BlogInlineCTA({ href, children, lead }: BlogInlineCTAProps) {
1212
href.startsWith("http://") || href.startsWith("https://");
1313

1414
return (
15-
<div className="not-prose">
16-
<p className="font-body text-[0.95rem] leading-relaxed text-on-surface-variant/75">
17-
{lead ? <span>{lead} </span> : null}
18-
<a
19-
href={href}
20-
{...(isExternal
21-
? { target: "_blank", rel: "noopener noreferrer" }
22-
: {})}
23-
className="group inline-flex items-baseline gap-1.5 text-[#cbb5f4] underline decoration-[#a993d1]/40 decoration-from-font underline-offset-[5px] transition-colors hover:decoration-[#cbb5f4]"
15+
<div className="not-prose font-body text-[0.95rem] leading-relaxed text-on-surface-variant/75">
16+
{lead ? <span>{lead} </span> : null}
17+
<a
18+
href={href}
19+
{...(isExternal
20+
? { target: "_blank", rel: "noopener noreferrer" }
21+
: {})}
22+
className="group inline-flex items-baseline gap-1.5 text-[#cbb5f4] underline decoration-[#a993d1]/40 decoration-from-font underline-offset-[5px] transition-colors hover:decoration-[#cbb5f4]"
23+
>
24+
{children}
25+
<span
26+
aria-hidden
27+
className="inline-block translate-y-[1px] transition-transform group-hover:translate-x-0.5"
2428
>
25-
{children}
26-
<span
27-
aria-hidden
28-
className="inline-block translate-y-[1px] transition-transform group-hover:translate-x-0.5"
29-
>
30-
31-
</span>
32-
</a>
33-
</p>
29+
30+
</span>
31+
</a>
3432
</div>
3533
);
3634
}

0 commit comments

Comments
 (0)