Skip to content

An open-source, self-hosted system for apps built with web technologies.

Let launcher Surface own popover

zohayrslileh5578bf48e7eb
diff --git a/source/client/view/structure/desktop/taskbar/launcher/launcher.tsx b/source/client/view/structure/desktop/taskbar/launcher/launcher.tsx
index 51d29ce..6250ddc 100644
--- a/source/client/view/structure/desktop/taskbar/launcher/launcher.tsx
+++ b/source/client/view/structure/desktop/taskbar/launcher/launcher.tsx
@@ -1,7 +1,7 @@
-import { ComponentProps, ReactNode, useCallback, useEffect, useId, useRef, useState } from "react"
+import { ReactNode, useCallback, useEffect, useId, useRef, useState } from "react"
import { enterSurface, prepareSurfaceEntrance, restSurface } from "../../../../appearance/surface-presence"
import { useReducedMotion } from "@libs/react-motion"
-import { Surface, useAppearance, useResolveTheme, useScale } from "@phreshos/react-ui"
+import { Surface, useAppearance, useResolveTheme, useScale, type SurfaceProps } from "@phreshos/react-ui"
import TaskbarSurface, { taskbarSurfaceClassName } from "../taskbar-surface"
import TaskbarButton from "../taskbar-button"
@@ -13,7 +13,7 @@ export default function ({ label, trigger, children, className, style, ...props
const id = useId()
- const surface = useRef<HTMLElement>(null)
+ const surface = useRef<HTMLDivElement>(null)
const reducedMotion = useReducedMotion()
@@ -70,7 +70,7 @@ export default function ({ label, trigger, children, className, style, ...props
</TaskbarButton>
- <section
+ <TaskbarSurface
{...props}
@@ -84,6 +84,12 @@ export default function ({ label, trigger, children, className, style, ...props
aria-labelledby={`${id}-label`}
+ label={label}
+
+ labelId={`${id}-label`}
+
+ contentClassName=""
+
tabIndex={-1}
style={{ ...style, borderRadius: radius }}
@@ -116,22 +122,18 @@ export default function ({ label, trigger, children, className, style, ...props
>
- <TaskbarSurface label={label} labelId={`${id}-label`} contentClassName="">
-
- <Surface opacity="small" className="min-h-0 max-h-[inherit] rounded-[inherit]">
-
- {children(close)}
+ <Surface opacity="small" className="min-h-0 max-h-[inherit] rounded-[inherit]">
- </Surface>
+ {children(close)}
- </TaskbarSurface>
+ </Surface>
- </section>
+ </TaskbarSurface>
</>
}
-export interface LauncherProps extends Omit<ComponentProps<"section">, "children" | "id" | "onBeforeToggle" | "onToggle" | "popover"> {
+export interface LauncherProps extends Omit<SurfaceProps, "children" | "id" | "onBeforeToggle" | "onToggle" | "popover"> {
label: string
diff --git a/source/client/view/structure/desktop/taskbar/taskbar-surface.tsx b/source/client/view/structure/desktop/taskbar/taskbar-surface.tsx
index 143ae76..94ccad8 100644
--- a/source/client/view/structure/desktop/taskbar/taskbar-surface.tsx
+++ b/source/client/view/structure/desktop/taskbar/taskbar-surface.tsx
@@ -1,14 +1,14 @@
-import { ReactNode } from "react"
-import { Surface, useAppearance, useResolveTheme, useScale } from "@phreshos/react-ui"
+import { forwardRef, ReactNode } from "react"
+import { Surface, useAppearance, useResolveTheme, useScale, type SurfaceProps } from "@phreshos/react-ui"
/** The window-material shell shared by surfaces opened from the taskbar. */
export const taskbarSurfaceClassName = "m-0 isolate border-0 bg-transparent p-0 shadow-window-active outline-none"
-export default function TaskbarSurface({ label, labelId, contentClassName = "bg-white/25 shadow-window-content", children }: TaskbarSurfaceProps) {
+export default forwardRef<HTMLDivElement, TaskbarSurfaceProps>(function TaskbarSurface({ label, labelId, contentClassName = "bg-white/25 shadow-window-content", className, children, ...props }, ref) {
const contentRadius = useScale(useResolveTheme(useAppearance().radius)).medium
- return <Surface className="grid min-h-0 max-h-[inherit] grid-rows-[auto_minmax(0,1fr)] rounded-[inherit]">
+ return <Surface {...props} ref={ref} className={`grid min-h-0 max-h-[inherit] grid-rows-[auto_minmax(0,1fr)] ${className ?? ""}`}>
<h2 id={labelId} className="relative grid h-10 items-center px-3.5 text-window-title font-medium select-none">{label}</h2>
@@ -19,9 +19,9 @@ export default function TaskbarSurface({ label, labelId, contentClassName = "bg-
</div>
</Surface>
-}
+})
-interface TaskbarSurfaceProps {
+interface TaskbarSurfaceProps extends Omit<SurfaceProps, "children"> {
label: string