refactor: Migrate documentation content, rebuild UI components, and update core architecture.

This commit is contained in:
gitfromwildan
2026-03-10 01:38:58 +07:00
parent aac81dff8a
commit ab755844a3
132 changed files with 3947 additions and 12862 deletions

View File

@@ -1,4 +1,4 @@
import { EachRoute } from "@/lib/routes-config";
import { EachRoute } from "@/lib/routes";
import Anchor from "./anchor";
import {
Collapsible,
@@ -27,7 +27,7 @@ export default function SubLink({
parentHref = "",
}: SubLinkProps) {
const path = usePathname();
const [isOpen, setIsOpen] = useState(false);
const [isOpen, setIsOpen] = useState(level === 0);
// Full path including parent's href
const fullHref = `${parentHref}${href}`;
@@ -54,6 +54,7 @@ export default function SubLink({
<Anchor
activeClassName={!hasActiveChild ? "dark:text-accent text-primary font-medium" : ""}
href={fullHref}
data-search-lvl0={level === 0 && hasActiveChild ? "true" : undefined}
className={cn(
"text-foreground/80 hover:text-foreground transition-colors",
hasActiveChild && "font-medium text-foreground"
@@ -61,7 +62,7 @@ export default function SubLink({
>
{title}
</Anchor>
), [title, fullHref, hasActiveChild]);
), [title, fullHref, hasActiveChild, level]);
const titleOrLink = !noLink ? (
isSheet ? (
@@ -70,10 +71,13 @@ export default function SubLink({
Comp
)
) : (
<h4 className={cn(
"font-medium sm:text-sm text-foreground/90 hover:text-foreground transition-colors",
hasActiveChild ? "text-foreground" : "text-foreground/80"
)}>
<h4
data-search-lvl0={level === 0 && hasActiveChild ? "true" : undefined}
className={cn(
"font-medium sm:text-sm text-foreground/90 hover:text-foreground transition-colors",
hasActiveChild ? "text-foreground" : "text-foreground/80"
)}
>
{title}
</h4>
);
@@ -86,11 +90,7 @@ export default function SubLink({
<div className={cn("flex flex-col gap-1 w-full")}>
<Collapsible open={isOpen} onOpenChange={setIsOpen}>
<CollapsibleTrigger
className={cn(
"w-full pr-5 text-left rounded-md transition-colors",
isOpen && "bg-muted/30 pb-2 pt-2", // Background when open
hasActiveChild && "bg-primary/5" // Accent tint when child is active
)}
className="w-full pr-5 text-left cursor-pointer"
aria-expanded={isOpen}
aria-controls={`collapsible-${fullHref.replace(/[^a-zA-Z0-9]/g, '-')}`}
>
@@ -108,13 +108,13 @@ export default function SubLink({
<CollapsibleContent
id={`collapsible-${fullHref.replace(/[^a-zA-Z0-9]/g, '-')}`}
className={cn(
"pl-3 overflow-hidden transition-all duration-200 ease-in-out",
"overflow-hidden transition-all duration-200 ease-in-out",
isOpen ? "animate-collapsible-down" : "animate-collapsible-up"
)}
>
<div
className={cn(
"flex flex-col items-start sm:text-sm text-foreground/80 ml-0.5 mt-1.5 gap-3 transition-colors",
"flex flex-col items-start sm:text-sm text-foreground/80 ml-0.5 mt-2.5 gap-3 hover:[&_a]:text-foreground transition-colors",
level > 0 && "pl-4 border-l border-border ml-1.5"
)}
>