react-arborist icon indicating copy to clipboard operation
react-arborist copied to clipboard

need example for renderCursor or renderDragPreview

Open mafin1799 opened this issue 2 years ago • 4 comments

mafin1799 avatar Jan 12 '24 15:01 mafin1799

Like the Gmail example? here is the code: https://github.com/brimdata/react-arborist/blob/main/packages/showcase/pages/gmail.tsx

mawnir avatar Jan 16 '24 15:01 mawnir

const MyDragPreview: React.FC<DragPreviewProps> = ({ offset }) => { const style: React.CSSProperties = { position: 'absolute', top: offset ? offset.y : -50, left: offset ? offset.x : -50, height: 30, width: 30, minWidth: 30, };

return <div style={style}>
    <Avatar icon={'pi pi-check'} size="normal" shape="circle" />
</div>;

}; ` thanks it's my solution for preview

mafin1799 avatar Jan 18 '24 13:01 mafin1799

const MyDragPreview: React.FC = ({ offset }) => { const style: React.CSSProperties = { position: 'absolute', top: offset ? offset.y : -50, left: offset ? offset.x : -50, height: 30, width: 30, minWidth: 30, };

return <div style={style}>
    <Avatar icon={'pi pi-check'} size="normal" shape="circle" />
</div>;

}; ` thanks it's my solution for preview

do you have an example of 'oncreate'?

mawnir avatar Jan 18 '24 13:01 mawnir

no

const MyDragPreview: React.FC = ({ offset }) => { const style: React.CSSProperties = { position: 'absolute', top: offset ? offset.y : -50, left: offset ? offset.x : -50, height: 30, width: 30, minWidth: 30, };

return <div style={style}>
    <Avatar icon={'pi pi-check'} size="normal" shape="circle" />
</div>;

}; ` thanks it's my solution for preview

do you have an example of 'oncreate'?

there is no tree that controls itself in the backend

mafin1799 avatar Jan 18 '24 14:01 mafin1799

Since we don't have access to useTreeApi like the source code, how are we supposed to customize the drag preview? I don't have any of the props or metadata my Item renderer relies on. I don't even have the label.

doulighan avatar Nov 12 '24 17:11 doulighan

https://github.com/brimdata/react-arborist/blob/main/packages/showcase/pages/gmail.tsx

Create one. i recreated the TreeApi for something similir to this Gmail example.

mawnir avatar Nov 12 '24 20:11 mawnir