diff --git a/components/docs-sidebar.tsx b/components/docs-sidebar.tsx
index 3753080..d209174 100644
--- a/components/docs-sidebar.tsx
+++ b/components/docs-sidebar.tsx
@@ -3,6 +3,7 @@
import * as React from "react"
import Link from "next/link"
import { usePathname } from "next/navigation"
+import { LayoutGroup, motion, useReducedMotion } from "motion/react"
import { DocsSidebarTrigger } from "@/components/docs-sidebar-trigger"
import { Logo } from "@/components/logo"
@@ -48,28 +49,78 @@ function isCurrent(pathname: string, url: string) {
return pathname === url
}
+const headingClassName =
+ "mt-4 mb-0.5 h-auto px-3 py-1 truncate text-[11px] font-medium tracking-[0.16em] text-foreground/35 uppercase first:mt-0"
+
+const markSpring = {
+ type: "spring" as const,
+ stiffness: 460,
+ damping: 34,
+ mass: 0.7,
+}
+
+function DashMark({
+ layoutId,
+ opacity,
+}: {
+ layoutId: string
+ opacity: number
+}) {
+ const reduce = useReducedMotion() ?? false
+
+ return (
+
+ )
+}
+
+type TabHover = {
+ hoveredUrl: string | null
+ onHover: (url: string) => void
+}
+
function PageItem({
node,
pathname,
indented = false,
+ hoveredUrl,
+ onHover,
}: {
node: PageNode
pathname: string
indented?: boolean
-}) {
+} & TabHover) {
+ const active = isCurrent(pathname, node.url)
+ const showHover = hoveredUrl === node.url && !active
+
return (
-
+ onHover(node.url)}
+ onMouseEnter={() => onHover(node.url)}
+ >
}
- isActive={isCurrent(pathname, node.url)}
+ isActive={active}
className={cn(
- "hover:bg-foreground/5 data-active:bg-foreground/10",
+ "h-8 gap-0 overflow-visible rounded-lg bg-transparent font-normal text-foreground/45 transition-colors duration-200 hover:bg-transparent hover:text-foreground/80 active:bg-transparent data-active:bg-transparent data-active:font-normal data-active:text-foreground data-active:hover:bg-transparent data-active:hover:text-foreground [&>span:last-child]:overflow-visible [&>span:last-child]:text-clip",
indented && "pl-6"
)}
>
- {node.name}
+ {node.name}
+ {active ? (
+
+ ) : null}
+ {showHover ? (
+
+ ) : null}
)
@@ -81,9 +132,7 @@ function SeparatorItem({ node }: { node: SeparatorNode }) {
}
return (
-
- {node.name}
-
+ {node.name}
)
}
@@ -95,28 +144,37 @@ function NavItems({
nodes,
pathname,
indented = false,
+ hoveredUrl,
+ onHover,
}: {
nodes: TreeNode[]
pathname: string
indented?: boolean
-}) {
+} & TabHover) {
+ let inSection = indented
+
return nodes.map((node, i) => {
- if (isPage(node)) {
+ if (isSeparator(node)) {
+ if (node.name != null && node.name !== "") {
+ inSection = true
+ }
return (
-
)
}
- if (isSeparator(node)) {
+ if (isPage(node)) {
return (
-
)
}
@@ -127,14 +185,24 @@ function NavItems({
return (
{node.index ? (
-
+
) : hasSectionedChildren ? null : (
- {node.name}
+
+ {node.name}
+
)}
)
@@ -153,10 +221,23 @@ function NavList({
pathname: string
indented?: boolean
}) {
+ const [hoveredUrl, setHoveredUrl] = React.useState(null)
+
return (
-
-
-
+
)
}
diff --git a/registry/phosphor-score/phosphor-score-demo.tsx b/registry/phosphor-score/phosphor-score-demo.tsx
index 1d4c9d8..5737f75 100644
--- a/registry/phosphor-score/phosphor-score-demo.tsx
+++ b/registry/phosphor-score/phosphor-score-demo.tsx
@@ -12,6 +12,7 @@ import { ComponentPreview } from "@/components/component-preview"
import { useHydratedTheme } from "@/hooks/use-hydrated-theme"
import { usePreviewProps } from "@/hooks/use-preview-props"
import {
+ DARK_BG,
DARK_COLOR,
DEFAULT_DENSITY,
DEFAULT_GLOW,
@@ -60,9 +61,12 @@ export function PhosphorScoreDemo() {
<>
-