From 43fe8ad1b3bf1deb26bf8bee9d5a8973f26f05af Mon Sep 17 00:00:00 2001 From: ValdiANS Date: Tue, 20 Jan 2026 17:33:38 +0700 Subject: [PATCH] feat: create PopoverContent component --- src/components/popover/PopoverContent.tsx | 71 +++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/components/popover/PopoverContent.tsx diff --git a/src/components/popover/PopoverContent.tsx b/src/components/popover/PopoverContent.tsx new file mode 100644 index 00000000..9a634abb --- /dev/null +++ b/src/components/popover/PopoverContent.tsx @@ -0,0 +1,71 @@ +import { cn } from '@/lib/helper'; + +export interface PopoverContentProps { + children: React.ReactNode; + id: string; + anchorName: string; // Must include `--` like "--menu-anchor" + popover?: 'auto' | 'hint' | 'manual'; + position?: + | 'top' + | 'bottom' + | 'left' + | 'right' + | 'top-start' + | 'top-end' + | 'bottom-start' + | 'bottom-end' + | 'left-start' + | 'left-end' + | 'right-start' + | 'right-end'; + className?: string; +} + +const positionAreaMap: Record< + NonNullable, + string +> = { + top: 'top center', + bottom: 'bottom center', + left: 'left center', + right: 'right center', + + 'top-start': 'top left', + 'top-end': 'top right', + 'bottom-start': 'bottom left', + 'bottom-end': 'bottom right', + + 'left-start': 'left top', + 'left-end': 'left bottom', + + 'right-start': 'right top', + 'right-end': 'right bottom', +}; + +const PopoverContent = ({ + children, + id, + anchorName, + popover = 'auto', + position = 'bottom-start', + className, +}: PopoverContentProps) => { + return ( +
+ {children} +
+ ); +}; + +export default PopoverContent;