Skip to content

Commit cde4ff6

Browse files
committed
fix header links, css issues and nav issue
1 parent 64b340c commit cde4ff6

5 files changed

Lines changed: 32 additions & 48 deletions

File tree

src/docs-app/ui/components/content/HeaderWithLink.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ const HeaderWithLink: React.FC<HeaderWithLinkProps> = ({
3737
}
3838
};
3939

40-
const baseClasses = "group relative scroll-mt-24 text-foreground";
40+
const baseClasses = "group relative";
4141
const levelClasses = {
42-
1: "text-3xl font-bold mt-12 mb-2 leading-tight",
43-
2: "text-2xl font-semibold mt-6 mb-4 leading-snug",
44-
3: "text-xl font-semibold mt-8 mb-3 leading-snug",
45-
4: "text-lg font-medium mt-6 mb-2",
42+
1: "text-3xl font-bold mt-12 mb-2 scroll-mt-24 text-foreground leading-tight",
43+
2: "text-2xl font-semibold mt-6 mb-4 scroll-mt-24 text-foreground leading-snug",
44+
3: "text-xl font-semibold mt-8 mb-3 scroll-mt-24 text-foreground leading-snug",
45+
4: "text-lg font-medium mt-6 mb-2 scroll-mt-24 text-foreground",
4646
};
4747

4848
const Tag = `h${level}` as keyof JSX.IntrinsicElements;

src/docs-app/ui/components/content/MarkdownContent.tsx

Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import ReactMarkdown from "react-markdown";
33
import remarkGfm from "remark-gfm";
44
import rehypeRaw from "rehype-raw";
55
import CodeBlock from "@/docs-app/ui/components/content/CodeBlock.tsx";
6+
import HeaderWithLink from "@/docs-app/ui/components/content/HeaderWithLink.tsx";
67
import type { Components } from "react-markdown";
78
import type { Root, Element as MdElement, Text as MdText } from "hast"; // Import HAST types
89
import {
@@ -110,57 +111,41 @@ const MarkdownContent: React.FC<MarkdownContentProps> = ({ content }) => {
110111
h1: ({ node, children, ...props }) => {
111112
const text = extractTextFromChildren(children);
112113
const id = generateHeadingId(text);
113-
return (
114-
<>
115-
<h1
116-
id={id}
117-
className="text-3xl font-bold mt-12 mb-2 scroll-mt-24 text-foreground leading-tight"
118-
{...props}
119-
>
120-
{children}
121-
</h1>
122-
<Separator className="mb-2 opacity-60" />
123-
</>
124-
);
114+
return (
115+
<>
116+
<HeaderWithLink id={id} level={1} {...props}>
117+
{children}
118+
</HeaderWithLink>
119+
<Separator className="mb-2 opacity-60" />
120+
</>
121+
);
125122
},
126123
h2: ({ node, children, ...props }) => {
127124
const text = extractTextFromChildren(children);
128125
const id = generateHeadingId(text);
129-
return (
130-
<h2
131-
id={id}
132-
className="text-2xl font-semibold mt-6 mb-4 scroll-mt-24 text-foreground leading-snug"
133-
{...props}
134-
>
135-
{children}
136-
</h2>
137-
);
126+
return (
127+
<HeaderWithLink id={id} level={2} {...props}>
128+
{children}
129+
</HeaderWithLink>
130+
);
138131
},
139132
h3: ({ node, children, ...props }) => {
140133
const text = extractTextFromChildren(children);
141134
const id = generateHeadingId(text);
142-
return (
143-
<h3
144-
id={id}
145-
className="text-xl font-semibold mt-8 mb-3 scroll-mt-24 text-foreground leading-snug"
146-
{...props}
147-
>
148-
{children}
149-
</h3>
150-
);
135+
return (
136+
<HeaderWithLink id={id} level={3} {...props}>
137+
{children}
138+
</HeaderWithLink>
139+
);
151140
},
152141
h4: ({ node, children, ...props }) => {
153142
const text = extractTextFromChildren(children);
154143
const id = generateHeadingId(text);
155-
return (
156-
<h4
157-
id={id}
158-
className="text-lg font-medium mt-6 mb-2 scroll-mt-24 text-foreground"
159-
{...props}
160-
>
161-
{children}
162-
</h4>
163-
);
144+
return (
145+
<HeaderWithLink id={id} level={4} {...props}>
146+
{children}
147+
</HeaderWithLink>
148+
);
164149
},
165150
a: ({ node, ...props }) => (
166151
<a

src/docs-app/ui/components/layout/DocLayout.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ const DocLayout = () => {
9696
>
9797
<div className="flex h-full flex-col">
9898
{/* Mobile Sidebar Header */}
99-
<div className="flex items-center justify-between border-b p-4 lg:hidden">
100-
<span className="ml-2 font-semibold">Navigation</span>
99+
<div className="flex items-center justify-end border-b p-4 lg:hidden">
101100
<Button
102101
variant="ghost"
103102
size="icon"

src/docs-app/ui/components/navigation/Navigation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ const Navigation = ({ currentPath, onNavigate }: NavigationProps) => {
678678
</Accordion>
679679
</div>
680680

681-
<div className="fixed bottom-0 left-0 w-[250px] border-t border-sidebar-border p-2 flex justify-between items-center bg-sidebar z-10">
681+
<div className="fixed bottom-0 left-0 w-full md:w-[329px] border-t border-sidebar-border p-2 flex justify-between items-center bg-sidebar z-10">
682682
<ThemeToggle />
683683
</div>
684684
</div>

src/shared/components/TopNavigation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const TopNavigation = () => {
1111
const currentLogo = (resolvedTheme === "forest" || resolvedTheme === "ocean") ? logoWhiteSrc : logoRedSrc;
1212

1313
return (
14-
<header className="sticky top-0 z-50 border-b border-border/50 bg-sidebar/95 backdrop-blur shadow-sm supports-[backdrop-filter]:bg-sidebar/60">
14+
<header className="sticky top-0 z-50 border-b border-border/50 bg-sidebar/95">
1515
<div className="flex h-16 items-center">
1616
{/* Logo - Flush left with padding */}
1717
<div className="flex items-center flex-shrink-0 pl-4 lg:pl-6">

0 commit comments

Comments
 (0)