Float the dashboard rail along the bottom on a phone
Below md a dashboard stacks to one column and dropped its rail. The rail is
now a horizontal row in the dashboard's own look, floated over the bottom
of the screen on /panel/{id} and above the dock in the app's view, with
44px items, sideways scrolling when it overflows, and padding so the last
tile clears it; a panel's read-only notice moves up out of its way. The
three looks share the geometry from ui/core.
This commit is contained in:
@@ -23,7 +23,7 @@ import type {
|
||||
NoticeProps,
|
||||
RailProps,
|
||||
} from "../core/contract"
|
||||
import { TESTID } from "../core/contract"
|
||||
import { railGeometry, TESTID } from "../core/contract"
|
||||
import { LOOK } from "../core/motion"
|
||||
|
||||
/** The page colour is the ground; only an image is drawn over it. */
|
||||
@@ -110,19 +110,13 @@ export function Frame({
|
||||
)
|
||||
}
|
||||
|
||||
export function Rail({ entries }: RailProps) {
|
||||
export function Rail({ entries, horizontal }: RailProps) {
|
||||
return (
|
||||
<nav
|
||||
aria-label="Dashboards on this panel"
|
||||
data-testid={TESTID.rail}
|
||||
className={cn(
|
||||
"dui-rail fx-rail pointer-events-auto absolute left-3 top-1/2 z-10 flex max-h-[calc(100%-1.5rem)] w-12 -translate-y-1/2 flex-col items-center gap-1 p-1",
|
||||
// As tall as what it carries, centred in the column it reserves: a
|
||||
// rail of two stretched to the height of the panel is mostly empty
|
||||
// pill. More dashboards than the panel is tall still scroll, but no
|
||||
// bar is ever drawn — a wall panel is swiped, and there is no room.
|
||||
"overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
||||
)}
|
||||
data-orientation={horizontal ? "horizontal" : undefined}
|
||||
className={cn("dui-rail fx-rail", railGeometry(horizontal))}
|
||||
>
|
||||
{entries.map((entry) => {
|
||||
const Glyph = ICONS[entry.icon ?? ""]
|
||||
@@ -149,7 +143,9 @@ export function Rail({ entries }: RailProps) {
|
||||
</span>
|
||||
</Link>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right">{entry.label}</TooltipContent>
|
||||
<TooltipContent side={horizontal ? "top" : "right"}>
|
||||
{entry.label}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
)
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user