UI: Fix code styles in headings

This commit is contained in:
fuma-nama
2024-08-05 10:38:14 +08:00
parent fc9194b41e
commit e7c52f266c
3 changed files with 19 additions and 10 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-ui': patch
---
Fix code styles in headings
+8 -7
View File
@@ -29,13 +29,14 @@ const ImageZoom = dynamic(() =>
export default {
heading: (
<Wrapper>
<Heading
id="preview"
as="h3"
className="!my-0 rounded-xl bg-fd-background p-4"
>
Hello World
</Heading>
<div className="rounded-lg bg-fd-background p-4 prose-no-margin">
<Heading id="preview" as="h3">
Hello World
</Heading>
<Heading id="preview" as="h3">
Hello <code>World</code> Everyone!
</Heading>
</div>
</Wrapper>
),
card: (
+6 -3
View File
@@ -17,13 +17,16 @@ export function Heading<T extends Types = 'h1'>({
if (!props.id) return <As className={className} {...props} />;
return (
<As className={cn('group inline-flex items-center scroll-m-20', className)} {...props}>
<a href={`#${props.id}`}>
<As
className={cn('flex scroll-m-20 flex-row items-center gap-2', className)}
{...props}
>
<a href={`#${props.id}`} className="peer">
{props.children}
</a>
<Link
aria-label="Link to section"
className="ms-2 size-4 text-fd-muted-foreground opacity-0 transition-opacity group-hover:opacity-100"
className="size-3.5 shrink-0 text-fd-muted-foreground opacity-0 transition-opacity peer-hover:opacity-100"
/>
</As>
);