refactor: moved dnd part from Funnel into FunnelDnd
This commit is contained in:
27
src/components/dnd/SortableItem/DragHandle.tsx
Normal file
27
src/components/dnd/SortableItem/DragHandle.tsx
Normal file
@ -0,0 +1,27 @@
|
||||
import React, { CSSProperties, ReactNode, useContext } from "react";
|
||||
import SortableItemContext from "@/components/dnd/SortableItem/SortableItemContext";
|
||||
|
||||
type Props = {
|
||||
children: ReactNode;
|
||||
style?: CSSProperties;
|
||||
};
|
||||
|
||||
const DragHandle = ({ children, style }: Props) => {
|
||||
const { attributes, listeners, ref } = useContext(SortableItemContext);
|
||||
|
||||
return (
|
||||
<div
|
||||
{...attributes}
|
||||
{...listeners}
|
||||
style={{
|
||||
width: "100%",
|
||||
cursor: "grab",
|
||||
...style,
|
||||
}}
|
||||
ref={ref}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default DragHandle;
|
||||
Reference in New Issue
Block a user