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