mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-03 08:07:21 +00:00
Replace the v3-authored shadcn components with their new-york-v4 equivalents via `npx shadcn add --overwrite`. The new components use the `radix-ui` meta-package, inline `cva` variants, `data-slot` attributes, and the v4 aria-invalid/focus-ring patterns. Also: - Remove now-unused @radix-ui/react-* packages (only react-toast is kept for the preserved toast/toaster). - Delete orphaned *-variants.ts / *-utils.ts files (variants are inline in v4). - Drop duplicate src/hooks/use-mobile.ts; sidebar now imports the existing useIsMobile hook. - Rewrite src/index.css in the shadcn v4 idiom: raw hsl() values on --background etc., with @theme inline remapping to --color-*. Switch --sidebar-background to --sidebar to match the new sidebar classes. - Keep toast.tsx, toaster.tsx, and qrcode.tsx untouched.
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
import * as React from "react"
|
|
import { HoverCard as HoverCardPrimitive } from "radix-ui"
|
|
|
|
import { cn } from "@/lib/utils"
|
|
|
|
function HoverCard({
|
|
...props
|
|
}: React.ComponentProps<typeof HoverCardPrimitive.Root>) {
|
|
return <HoverCardPrimitive.Root data-slot="hover-card" {...props} />
|
|
}
|
|
|
|
function HoverCardTrigger({
|
|
...props
|
|
}: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {
|
|
return (
|
|
<HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
|
|
)
|
|
}
|
|
|
|
function HoverCardContent({
|
|
className,
|
|
align = "center",
|
|
sideOffset = 4,
|
|
...props
|
|
}: React.ComponentProps<typeof HoverCardPrimitive.Content>) {
|
|
return (
|
|
<HoverCardPrimitive.Portal data-slot="hover-card-portal">
|
|
<HoverCardPrimitive.Content
|
|
data-slot="hover-card-content"
|
|
align={align}
|
|
sideOffset={sideOffset}
|
|
className={cn(
|
|
"z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
className
|
|
)}
|
|
{...props}
|
|
/>
|
|
</HoverCardPrimitive.Portal>
|
|
)
|
|
}
|
|
|
|
export { HoverCard, HoverCardTrigger, HoverCardContent }
|