CoastalCommitsPastes/client/app/components/popover/index.tsx

36 lines
892 B
TypeScript
Raw Normal View History

// largely from https://github.com/shadcn/taxonomy
import * as React from "react"
import * as PopoverPrimitive from "@radix-ui/react-popover"
import clsx from "clsx"
2022-11-18 01:36:53 -05:00
import styles from "./popover.module.css"
type PopoverProps = PopoverPrimitive.PopoverProps
export function Popover({ ...props }: PopoverProps) {
2022-11-18 01:36:53 -05:00
return <PopoverPrimitive.Root {...props} />
}
Popover.Trigger = React.forwardRef<
2022-11-18 01:36:53 -05:00
HTMLButtonElement,
PopoverPrimitive.PopoverTriggerProps
>(function PopoverTrigger({ ...props }, ref) {
2022-11-18 01:36:53 -05:00
return <PopoverPrimitive.Trigger {...props} ref={ref} />
})
Popover.Portal = PopoverPrimitive.Portal
Popover.Content = React.forwardRef<
2022-11-18 01:36:53 -05:00
HTMLDivElement,
PopoverPrimitive.PopoverContentProps
>(function PopoverContent({ className, ...props }, ref) {
2022-11-18 01:36:53 -05:00
return (
<PopoverPrimitive.Content
ref={ref}
align="end"
className={clsx(styles.root, className)}
{...props}
/>
)
})