From 47d9e017657c4d265dea53bd86d727097a7ba282 Mon Sep 17 00:00:00 2001 From: Adam <2363879+adamdotdevin@users.noreply.github.com> Date: Thu, 16 Oct 2025 14:53:44 -0500 Subject: wip: css/ui and desktop work --- packages/ui/src/app.tsx | 38 ++++++++++++++++++++++++----- packages/ui/src/components/fonts.tsx | 44 ++++++++++++++++++++++++++++++++++ packages/ui/src/components/index.ts | 2 ++ packages/ui/src/components/tooltip.tsx | 44 ++++++++++++++++++++++++++++++++++ packages/ui/src/index.css | 10 ++++---- packages/ui/src/index.tsx | 10 +++++++- 6 files changed, 137 insertions(+), 11 deletions(-) create mode 100644 packages/ui/src/components/fonts.tsx create mode 100644 packages/ui/src/components/tooltip.tsx (limited to 'packages/ui/src') diff --git a/packages/ui/src/app.tsx b/packages/ui/src/app.tsx index f42781543..6f3e388e9 100644 --- a/packages/ui/src/app.tsx +++ b/packages/ui/src/app.tsx @@ -1,6 +1,5 @@ import type { Component } from "solid-js" -import { Button, Select, Tabs } from "./components" -import "@opencode-ai/css" +import { Button, Select, Tabs, Tooltip, Fonts } from "./components" import "./index.css" const App: Component = () => { @@ -17,6 +16,9 @@ const App: Component = () => { + @@ -26,6 +28,9 @@ const App: Component = () => { +

Select

@@ -88,14 +93,35 @@ const App: Component = () => {
+

Tooltips

+
+ + + + + + + + + + + + + `Dynamic tooltip: ${new Date().toLocaleTimeString()}`} placement="top"> + + +
) return ( -
- - -
+ <> + +
+ + +
+ ) } diff --git a/packages/ui/src/components/fonts.tsx b/packages/ui/src/components/fonts.tsx new file mode 100644 index 000000000..447c486e4 --- /dev/null +++ b/packages/ui/src/components/fonts.tsx @@ -0,0 +1,44 @@ +import { Style, Link } from "@solidjs/meta" +import geist from "@opencode-ai/css/fonts/geist.woff2" +import geistMono from "@opencode-ai/css/fonts/geist-mono.woff2" + +export const Fonts = () => { + return ( + <> + + + + + ) +} diff --git a/packages/ui/src/components/index.ts b/packages/ui/src/components/index.ts index be12d6a67..2048ec639 100644 --- a/packages/ui/src/components/index.ts +++ b/packages/ui/src/components/index.ts @@ -1,4 +1,6 @@ export * from "./button" export * from "./icon" +export * from "./fonts" export * from "./select" export * from "./tabs" +export * from "./tooltip" diff --git a/packages/ui/src/components/tooltip.tsx b/packages/ui/src/components/tooltip.tsx new file mode 100644 index 000000000..7cb22b290 --- /dev/null +++ b/packages/ui/src/components/tooltip.tsx @@ -0,0 +1,44 @@ +import { Tooltip as KobalteTooltip } from "@kobalte/core/tooltip" +import { children, createEffect, createSignal, splitProps } from "solid-js" +import type { ComponentProps } from "solid-js" + +export interface TooltipProps extends ComponentProps { + value: string | (() => string) + class?: string +} + +export function Tooltip(props: TooltipProps) { + const [open, setOpen] = createSignal(false) + const [local, others] = splitProps(props, ["children", "class"]) + + const c = children(() => local.children) + + createEffect(() => { + const childElements = c() + if (childElements instanceof HTMLElement) { + childElements.addEventListener("focus", () => setOpen(true)) + childElements.addEventListener("blur", () => setOpen(false)) + } else if (Array.isArray(childElements)) { + for (const child of childElements) { + if (child instanceof HTMLElement) { + child.addEventListener("focus", () => setOpen(true)) + child.addEventListener("blur", () => setOpen(false)) + } + } + } + }) + + return ( + + + {c()} + + + + {typeof others.value === "function" ? others.value() : others.value} + + + + + ) +} diff --git a/packages/ui/src/index.css b/packages/ui/src/index.css index b5f1cf302..ab8e72091 100644 --- a/packages/ui/src/index.css +++ b/packages/ui/src/index.css @@ -1,8 +1,10 @@ +@import "@opencode-ai/css"; + :root { body { margin: 0; - background-color: var(--background-background); - color: var(--text-default-text); + background-color: var(--background-base); + color: var(--text-base); } main { display: flex; @@ -35,6 +37,6 @@ } .dark { - background-color: var(--background-background); - color: var(--text-default-text); + background-color: var(--background-base); + color: var(--text-base); } diff --git a/packages/ui/src/index.tsx b/packages/ui/src/index.tsx index 0e4c4a018..caa8b1ccd 100644 --- a/packages/ui/src/index.tsx +++ b/packages/ui/src/index.tsx @@ -1,5 +1,6 @@ /* @refresh reload */ import { render } from "solid-js/web" +import { MetaProvider } from "@solidjs/meta" import App from "./app" @@ -11,4 +12,11 @@ if (import.meta.env.DEV && !(root instanceof HTMLElement)) { ) } -render(() => , root!) +render( + () => ( + + + + ), + root!, +) -- cgit v1.2.3