A self hosted solution for privately rating and reviewing different sorts of media
1import { DragHandleDots2Icon } from '@radix-ui/react-icons';
2import * as ResizablePrimitive from 'react-resizable-panels';
3
4import { cn } from '@/lib/utils';
5
6const ResizablePanelGroup = ({
7 className,
8 ...props
9}: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => (
10 <ResizablePrimitive.PanelGroup
11 className={cn(
12 'flex h-full w-full data-[panel-group-direction=vertical]:flex-col',
13 className
14 )}
15 {...props}
16 />
17);
18
19const ResizablePanel = ResizablePrimitive.Panel;
20
21const ResizableHandle = ({
22 withHandle,
23 className,
24 ...props
25}: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {
26 withHandle?: boolean;
27}) => (
28 <ResizablePrimitive.PanelResizeHandle
29 className={cn(
30 'bg-base-100 focus-visible:ring-base-950 relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90',
31 className
32 )}
33 {...props}
34 >
35 {withHandle && (
36 <div className="bg-base-100 z-10 flex h-4 w-3 items-center justify-center rounded-sm border">
37 <DragHandleDots2Icon className="h-2.5 w-2.5" />
38 </div>
39 )}
40 </ResizablePrimitive.PanelResizeHandle>
41);
42
43export { ResizablePanelGroup, ResizablePanel, ResizableHandle };