gitscope
← marzneshin / v0.6.0 / dashboard/src/components/ui/sortable/drag-handle.tsx
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/components/ui/sortable/drag-handle.tsx · TypeScript
Blame Raw
 1import React from "react";
 2import { Button, type ButtonProps } from "@marzneshin/components"
 3import { useSortableItem } from "./use-sortable-item";
 4import { composeRefs, cn } from "@marzneshin/utils";
 5
 6interface SortableDragHandleProps extends ButtonProps {
 7    withHandle?: boolean
 8}
 9
10export const SortableDragHandle = React.forwardRef<
11    HTMLButtonElement,
12    SortableDragHandleProps
13>(({ className, ...props }, ref) => {
14    const { attributes, listeners } = useSortableItem()
15
16    return (
17        <Button
18            ref={composeRefs(ref)}
19            className={cn("cursor-grab", className)}
20            {...attributes}
21            {...listeners}
22            {...props}
23        />
24    )
25})
26SortableDragHandle.displayName = "SortableDragHandle"