From 35dc1b2b444611aa03414a93638c40baab747ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Sat, 20 Jul 2024 01:39:39 +0200 Subject: [PATCH] UI work --- packages/webui/src/main.tsx | 2 +- packages/webui/src/routes/__root.tsx | 60 +++++++++++++++++++--------- 2 files changed, 42 insertions(+), 20 deletions(-) diff --git a/packages/webui/src/main.tsx b/packages/webui/src/main.tsx index 7f56c0a..ec8f689 100644 --- a/packages/webui/src/main.tsx +++ b/packages/webui/src/main.tsx @@ -20,7 +20,7 @@ declare module "@tanstack/react-router" { ReactDOM.createRoot(document.getElementById("root")!).render( - + diff --git a/packages/webui/src/routes/__root.tsx b/packages/webui/src/routes/__root.tsx index d4ffe66..7976401 100644 --- a/packages/webui/src/routes/__root.tsx +++ b/packages/webui/src/routes/__root.tsx @@ -1,4 +1,5 @@ -import { Link, createRootRoute, useMatch, useMatches } from "@tanstack/react-router" +import { Button, Container, Flex } from "@radix-ui/themes" +import { createRootRoute, useMatch, useMatches, useNavigate } from "@tanstack/react-router" import { AnimatePresence } from "framer-motion" import { Suspense, lazy } from "react" import { AnimatedOutlet } from "../AnimatedOutlet" @@ -10,6 +11,12 @@ const TanStackRouterDevtools = process.env.NODE_ENV === "production" default: res.TanStackRouterDevtools }))) +const ThemePanel = process.env.NODE_ENV === "production" + ? () => null + : lazy(() => import("@radix-ui/themes").then(res => ({ + default: res.ThemePanel + }))) + export function Root() { @@ -17,33 +24,48 @@ export function Root() { const match = useMatch({ strict: false }) const nextMatch = matches[ matches.findIndex(d => d.id === match.id) + 1 ] + const navigate = useNavigate() + return <> -
-
- + + + - +
+ + + - - + - -
+ initial={{ x: "100vw", opacity: 0 }} + animate={{ x: "0", opacity: 1 }} + exit={{ x: "-100vw", opacity: 0 }} + /> + - + + + + }