hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits
| 1 | import type { ParentProps } from "solid-js"; |
| 2 | import { Tooltip, TooltipContent } from "@/components/ui/tooltip"; |
| 3 | |
| 4 | /** |
| 5 | * The collapsed sidebar's label tooltip. The rail shows icons only, so each |
| 6 | * control names itself to the right of the rail on hover and on keyboard |
| 7 | * focus. Wrap a `TooltipTrigger` (usually with `as={...}` so the real control |
| 8 | * is the trigger); with `enabled` off the tooltip never opens, which is how |
| 9 | * the expanded sidebar, whose rows carry visible labels, stays quiet. |
| 10 | */ |
| 11 | export function RailTip(props: ParentProps<{ label: string; enabled: boolean }>) { |
| 12 | return ( |
| 13 | // `open={false}` as well as `disabled`: a tip already open when the rail |
| 14 | // expands (the collapse toggle, clicked) must close, not linger. |
| 15 | <Tooltip |
| 16 | placement="right" |
| 17 | gutter={12} |
| 18 | openDelay={200} |
| 19 | closeDelay={0} |
| 20 | disabled={!props.enabled} |
| 21 | open={props.enabled ? undefined : false} |
| 22 | > |
| 23 | {props.children} |
| 24 | <TooltipContent class="px-2.5 py-1.5 font-medium">{props.label}</TooltipContent> |
| 25 | </Tooltip> |
| 26 | ); |
| 27 | } |