Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Merge commit authors and hovercards: commits show their accounts, every name opens a card (repos 0016) | 1 | import { HoverCard as Primitive } from "radix-ui"; |
| 2 | import type { ComponentProps } from "react"; | |
| 3 | ||
| 4 | import { cn } from "../../lib/cn"; | |
| 5 | ||
| 6 | // shadcn/ui's hover card, styled with g1t's tokens. It opens on hover and | |
| 7 | // keyboard focus, never on touch: a tap on its trigger does what the | |
| 8 | // trigger does. Hover hints (a label, nothing more) use the Tooltip. | |
| 9 | ||
| 10 | export function HoverCard({ openDelay = 450, closeDelay = 150, ...props }: ComponentProps<typeof Primitive.Root>) { | |
| 11 | return <Primitive.Root openDelay={openDelay} closeDelay={closeDelay} {...props} />; | |
| 12 | } | |
| 13 | ||
| 14 | export const HoverCardTrigger = Primitive.Trigger; | |
| 15 | ||
| 16 | export function HoverCardContent({ | |
| 17 | className, | |
| 18 | align = "start", | |
| 19 | sideOffset = 6, | |
| 20 | ...props | |
| 21 | }: ComponentProps<typeof Primitive.Content>) { | |
| 22 | return ( | |
| 23 | <Primitive.Portal> | |
| 24 | <Primitive.Content | |
| 25 | align={align} | |
| 26 | sideOffset={sideOffset} | |
| 27 | collisionPadding={12} | |
| 28 | className={cn( | |
| 29 | "z-50 w-80 max-w-[calc(100vw-2rem)] rounded-xl border border-line-strong bg-raised p-4 text-sm text-fg shadow-xl shadow-black/40 outline-none", | |
| 30 | "origin-(--radix-hover-card-content-transform-origin) data-[state=open]:animate-pop-in data-[state=closed]:animate-pop-out motion-reduce:animate-none", | |
| 31 | className, | |
| 32 | )} | |
| 33 | {...props} | |
| 34 | /> | |
| 35 | </Primitive.Portal> | |
| 36 | ); | |
| 37 | } |
This file's history is long; its oldest lines are credited to the oldest commit read.