From 34a644952995d4aedd18d11d327bd8589f5b2610 Mon Sep 17 00:00:00 2001 From: knownotunknown <78577376+knownotunknown@users.noreply.github.com> Date: Sat, 3 Feb 2024 00:11:46 -0600 Subject: [PATCH] feat: drag only on vertical axis Made this change a while ago, but didn't push since it looks like we might switch to Elie's DnD. Pushing since it looks like there might still be reviewers. --- src/views/components/common/List/List.tsx | 34 +++++++++++++++++------ 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/views/components/common/List/List.tsx b/src/views/components/common/List/List.tsx index 0d02e4ff..5dc1bb9f 100644 --- a/src/views/components/common/List/List.tsx +++ b/src/views/components/common/List/List.tsx @@ -109,16 +109,34 @@ const List: React.FC = ({ ( - { + let { style } = provided.draggableProps; + const transform = style?.transform; + + if (snapshot.isDragging && transform) { + let [x, y] = transform + .replace('translate(', '') + .replace(')', '') + .split(',') + .map((v) => parseInt(v, 10)); + + style.transform = `translate(0px, ${y}px)`; + } - }} - /> + style.fontFamily = "Inter"; + + return ( + )} + } > {provided => (