From 41f4515733dd8586d0fbbec37e7ee906cae1abb4 Mon Sep 17 00:00:00 2001 From: Omri Attiya Date: Fri, 21 Aug 2026 01:53:26 +0300 Subject: [PATCH 1/4] Enhance UI and functionality with CSS transitions, viewport meta tag update, and new search overlay motion handling - Added CSS variables for smoother transitions and animations across elements. - Updated viewport meta tag for improved responsiveness. - Introduced `bindSearchOverlayMotion` function to manage search overlay animations on DOM changes. - Refactored `App` component to utilize a new `NestedNavLink` for cleaner navigation structure. - Improved accessibility and user experience with consistent button styles and corrected text descriptions in routes. --- index.css | 78 ++++++++++++++++ index.html | 5 +- index.tsx | 5 +- src/App.tsx | 38 +++++--- src/routes/ConditionalPanelsRoute.tsx | 6 +- src/routes/OverflowRoute.tsx | 4 +- src/routes/UseDefaultLayoutRoute.tsx | 124 ++++++++++++++------------ src/searchOverlayMotion.ts | 52 +++++++++++ 8 files changed, 234 insertions(+), 78 deletions(-) create mode 100644 src/searchOverlayMotion.ts diff --git a/index.css b/index.css index 6826a20d1..d755f5220 100644 --- a/index.css +++ b/index.css @@ -12,3 +12,81 @@ --color-focus-2: var(--color-sky-400); --color-focus-3: var(--color-sky-600); } + +:root { + --docs-ease: cubic-bezier(0.16, 1, 0.3, 1); + --docs-duration: 160ms; + font-size: 14px; + line-height: 1.5; +} + +* { + transition: + color var(--docs-duration) var(--docs-ease), + background-color var(--docs-duration) var(--docs-ease), + border-color var(--docs-duration) var(--docs-ease), + opacity var(--docs-duration) var(--docs-ease), + fill var(--docs-duration) var(--docs-ease), + outline-color var(--docs-duration) var(--docs-ease) !important; +} + +.tok-comment { + color: var(--color-slate-400); +} + +#root section:has(> nav) { + overflow-x: hidden; + overflow-y: auto; + padding: 1.5rem 1rem; + scrollbar-width: thin; + scrollbar-color: var(--color-slate-400) transparent; +} + +#root nav { + height: auto; + overflow: visible; + padding: 0; + margin: 0; +} + +#root .fixed.inset-0.backdrop-blur-md { + padding-top: 10vh; + background: rgb(0 0 0 / 0.4); + animation: docs-search-in var(--docs-duration) var(--docs-ease) both; +} + +#root .fixed.inset-0.backdrop-blur-md > div { + box-shadow: + 0 0 0 1px oklch(0.72 0.2 320 / 0.4), + 0 12px 40px oklch(0.45 0.2 300 / 0.5), + 0 0 72px oklch(0.55 0.24 320 / 0.55); +} + +#root .fixed.inset-0.backdrop-blur-md[data-docs-search-exit] { + animation: docs-search-out var(--docs-duration) var(--docs-ease) both; +} + +@keyframes docs-search-in { + from { + opacity: 0; + } + to { + opacity: 1; + } +} + +@keyframes docs-search-out { + from { + opacity: 1; + } + to { + opacity: 0; + } +} + +@media (prefers-reduced-motion: reduce) { + * { + transition: none !important; + animation: none !important; + } +} diff --git a/index.html b/index.html index 53bcf40ab..4e0258d34 100644 --- a/index.html +++ b/index.html @@ -6,10 +6,7 @@ - + diff --git a/index.tsx b/index.tsx index 7cce56857..e9f09c708 100644 --- a/index.tsx +++ b/index.tsx @@ -2,9 +2,12 @@ import { StrictMode } from "react"; import { createRoot } from "react-dom/client"; import "./index.css"; import App from "./src/App.tsx"; +import { bindSearchOverlayMotion } from "./src/searchOverlayMotion"; -createRoot(document.getElementById("root")!).render( +const root = document.getElementById("root")!; +createRoot(root).render( ); +bindSearchOverlayMotion(); diff --git a/src/App.tsx b/src/App.tsx index a37ca5122..218419045 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,5 @@ import { ArrowTurnDownRightIcon } from "@heroicons/react/20/solid"; +import { type ReactNode } from "react"; import { AppRoot, Callout, @@ -17,6 +18,24 @@ import { Panel } from "./components/styled-panels/Panel"; import { Separator } from "./components/styled-panels/Separator"; import { routes } from "./routes"; +function NestedNavLink({ + children, + path +}: { + children: ReactNode; + path: Parameters[0]["path"]; +}) { + return ( + + + {children} + + ); +} + export default function App() { return ( Persistent layouts - - + Conditional panels - - - Server - rendering - - - Server - components - + + + Server rendering + + + Server components + Nested groups Conditional panels diff --git a/src/routes/ConditionalPanelsRoute.tsx b/src/routes/ConditionalPanelsRoute.tsx index 510489c63..22377edbc 100644 --- a/src/routes/ConditionalPanelsRoute.tsx +++ b/src/routes/ConditionalPanelsRoute.tsx @@ -12,16 +12,16 @@ export default function ConditionalPanelsRoute() { return (
-
Panel can be conditionally rendered.
+
Panels can be conditionally rendered.