diff options
| author | Adam <[email protected]> | 2025-10-23 06:33:52 -0500 |
|---|---|---|
| committer | Adam <[email protected]> | 2025-10-24 12:16:32 -0500 |
| commit | 35dec0649db8f46bffd7121af9cd301668e69e8c (patch) | |
| tree | 0f283d42503b05706233f04fe80b4159d4dfdb06 | |
| parent | 78a7f7914369f3945fbe8dd0f570bd9960199780 (diff) | |
| download | opencode-35dec0649db8f46bffd7121af9cd301668e69e8c.tar.gz opencode-35dec0649db8f46bffd7121af9cd301668e69e8c.zip | |
wip: desktop work
| -rw-r--r-- | packages/desktop/src/pages/index.tsx | 17 | ||||
| -rw-r--r-- | packages/ui/src/components/button.css | 16 | ||||
| -rw-r--r-- | packages/ui/src/components/button.tsx | 10 | ||||
| -rw-r--r-- | packages/ui/src/components/icon.tsx | 1 |
4 files changed, 30 insertions, 14 deletions
diff --git a/packages/desktop/src/pages/index.tsx b/packages/desktop/src/pages/index.tsx index 5dbec6439..2ddf7c18a 100644 --- a/packages/desktop/src/pages/index.tsx +++ b/packages/desktop/src/pages/index.tsx @@ -215,17 +215,14 @@ export default function Page() { <div class="relative h-screen flex flex-col"> <header class="hidden h-12 shrink-0 bg-background-strong border-b border-border-weak-base"></header> <main class="h-[calc(100vh-0rem)] flex"> - <div class="shrink-0 w-70 p-1.5 bg-background-weak border-r border-border-weak-base flex flex-col items-start gap-1.5"> - <div class="flex flex-col items-start self-stretch px-3 py-1"> - <span class="text-12-medium overflow-hidden text-ellipsis">{sync.data.path.directory}</span> + <div class="w-70 shrink-0 bg-background-weak border-r border-border-weak-base flex flex-col items-start"> + <div class="h-10 flex items-center self-stretch px-5 border-b border-border-weak-base"> + <span class="text-14-regular overflow-hidden text-ellipsis">{getFilename(sync.data.path.directory)}</span> </div> - <div class="flex flex-col items-start gap-4 self-stretch flex-1"> - <div class="px-3 py-1.5 w-full"> - <Button class="w-full" size="large" onClick={handleNewSession}> - <Icon name="plus" /> - New Session - </Button> - </div> + <div class="flex flex-col items-start gap-4 self-stretch flex-1 py-4 px-3"> + <Button class="w-full" size="large" onClick={handleNewSession} icon="edit-small-2"> + New Session + </Button> <List data={sync.data.session} key={(x) => x.id} diff --git a/packages/ui/src/components/button.css b/packages/ui/src/components/button.css index 7bf096853..0db3fcf37 100644 --- a/packages/ui/src/components/button.css +++ b/packages/ui/src/components/button.css @@ -45,6 +45,10 @@ border-color: var(--border-focus); background-color: var(--surface-focus); } + + [data-slot="icon"] { + color: var(--icon-strong-base); + } } &[data-variant="ghost"] { @@ -66,7 +70,10 @@ } &[data-size="normal"] { - padding: 0 6px 0 6px; + padding: 0 6px; + &[data-icon] { + padding: 0 6px 0 4px; + } font-size: var(--font-size-small); line-height: var(--line-height-large); @@ -75,7 +82,12 @@ &[data-size="large"] { height: 32px; - padding: 0 8px 0 6px; + padding: 0 8px; + + &[data-icon] { + padding: 0 8px 0 6px; + } + gap: 8px; font-family: var(--font-family-sans); diff --git a/packages/ui/src/components/button.tsx b/packages/ui/src/components/button.tsx index cae658439..d28e25afe 100644 --- a/packages/ui/src/components/button.tsx +++ b/packages/ui/src/components/button.tsx @@ -1,26 +1,32 @@ import { Button as Kobalte } from "@kobalte/core/button" -import { type ComponentProps, splitProps } from "solid-js" +import { type ComponentProps, Show, splitProps } from "solid-js" +import { Icon, IconProps } from "./icon" export interface ButtonProps extends ComponentProps<typeof Kobalte>, Pick<ComponentProps<"button">, "class" | "classList" | "children"> { size?: "normal" | "large" variant?: "primary" | "secondary" | "ghost" + icon?: IconProps["name"] } export function Button(props: ButtonProps) { - const [split, rest] = splitProps(props, ["variant", "size", "class", "classList"]) + const [split, rest] = splitProps(props, ["variant", "size", "icon", "class", "classList"]) return ( <Kobalte {...rest} data-component="button" data-size={split.size || "normal"} data-variant={split.variant || "secondary"} + data-icon={split.icon} classList={{ ...(split.classList ?? {}), [split.class ?? ""]: !!split.class, }} > + <Show when={split.icon}> + <Icon data-slot="icon" name={split.icon!} size="small" /> + </Show> {props.children} </Kobalte> ) diff --git a/packages/ui/src/components/icon.tsx b/packages/ui/src/components/icon.tsx index 36aa99a33..4933ebc79 100644 --- a/packages/ui/src/components/icon.tsx +++ b/packages/ui/src/components/icon.tsx @@ -135,6 +135,7 @@ const newIcons = { "chevron-down": `<path d="M6.6665 8.33325L9.99984 11.6666L13.3332 8.33325" stroke="currentColor" stroke-linecap="square"/>`, "arrow-up": `<path fill-rule="evenodd" clip-rule="evenodd" d="M9.99991 2.24121L16.0921 8.33343L15.2083 9.21731L10.6249 4.63397V17.5001H9.37492V4.63398L4.7916 9.21731L3.90771 8.33343L9.99991 2.24121Z" fill="currentColor"/>`, "check-small": `<path d="M6.5 11.4412L8.97059 13.5L13.5 6.5" stroke="currentColor" stroke-linecap="square"/>`, + "edit-small-2": `<path d="M17.0834 17.0833V17.5833H17.5834V17.0833H17.0834ZM2.91675 17.0833H2.41675V17.5833H2.91675V17.0833ZM2.91675 2.91659V2.41659H2.41675V2.91659H2.91675ZM9.58341 3.41659H10.0834V2.41659H9.58341V2.91659V3.41659ZM17.5834 10.4166V9.91659H16.5834V10.4166H17.0834H17.5834ZM10.4167 7.08325L10.0632 6.7297L9.91675 6.87615V7.08325H10.4167ZM10.4167 9.58325H9.91675V10.0833H10.4167V9.58325ZM12.9167 9.58325V10.0833H13.1239L13.2703 9.93681L12.9167 9.58325ZM15.4167 2.08325L15.7703 1.7297L15.4167 1.37615L15.0632 1.7297L15.4167 2.08325ZM17.9167 4.58325L18.2703 4.93681L18.6239 4.58325L18.2703 4.2297L17.9167 4.58325ZM17.0834 17.0833V16.5833H2.91675V17.0833V17.5833H17.0834V17.0833ZM2.91675 17.0833H3.41675V2.91659H2.91675H2.41675V17.0833H2.91675ZM2.91675 2.91659V3.41659H9.58341V2.91659V2.41659H2.91675V2.91659ZM17.0834 10.4166H16.5834V17.0833H17.0834H17.5834V10.4166H17.0834ZM10.4167 7.08325H9.91675V9.58325H10.4167H10.9167V7.08325H10.4167ZM10.4167 9.58325V10.0833H12.9167V9.58325V9.08325H10.4167V9.58325ZM10.4167 7.08325L10.7703 7.43681L15.7703 2.43681L15.4167 2.08325L15.0632 1.7297L10.0632 6.7297L10.4167 7.08325ZM15.4167 2.08325L15.0632 2.43681L17.5632 4.93681L17.9167 4.58325L18.2703 4.2297L15.7703 1.7297L15.4167 2.08325ZM17.9167 4.58325L17.5632 4.2297L12.5632 9.2297L12.9167 9.58325L13.2703 9.93681L18.2703 4.93681L17.9167 4.58325Z" fill="currentColor"/>`, } export interface IconProps extends ComponentProps<"svg"> { |
