From 4737c04f18d18d32b3e8611a818d99d9cfbb0b65 Mon Sep 17 00:00:00 2001 From: DevDaniloFerrari Date: Mon, 29 Jan 2024 11:59:15 -0300 Subject: [PATCH 1/4] logic to move emojis --- .../components/EmojiPicker/EmojiPicker.tsx | 17 +++- .../EmojiQuestionBlock/EmojiQuestionBlock.tsx | 82 ++++++++++++++----- .../createSurveyManager.ts | 25 ++++++ 3 files changed, 102 insertions(+), 22 deletions(-) diff --git a/src/features/surveys/features/SurveyCreator/components/EmojiPicker/EmojiPicker.tsx b/src/features/surveys/features/SurveyCreator/components/EmojiPicker/EmojiPicker.tsx index 00c222e7..e6be7180 100644 --- a/src/features/surveys/features/SurveyCreator/components/EmojiPicker/EmojiPicker.tsx +++ b/src/features/surveys/features/SurveyCreator/components/EmojiPicker/EmojiPicker.tsx @@ -6,6 +6,7 @@ import StyledDialog from 'shared/components/StyledDialog/StyledDialog'; import Picker from '@emoji-mart/react'; import Emoji from 'features/surveys/components/Emoji/Emoji'; import { EmojiObject } from 'features/surveys/features/SurveyCreator/components/EmojiPicker/EmojiObject'; +import { DraggableProvidedDragHandleProps } from 'react-beautiful-dnd'; interface EmojiPickerProps { index?: number; @@ -24,6 +25,7 @@ interface EmojiPickerProps { ) => void; onEmoteRemove?: (idx: number, questionIndex: number) => void; questionIndex: number; + dragHandleProps?: DraggableProvidedDragHandleProps | null | undefined; } function EmojiPicker({ @@ -34,6 +36,7 @@ function EmojiPicker({ onEmoteAdd, onEmoteRemove, questionIndex, + dragHandleProps, }: EmojiPickerProps) { const [displayPicker, setDisplayPicker] = useState(false); @@ -55,11 +58,23 @@ function EmojiPicker({ onClick={() => setDisplayPicker(!displayPicker)} > {!addEmoji ? ( - +
+ +
+ move +
+
) : ( )} + {onEmoteRemove && ( + {!addEmoji && ( +
+ m +
+ )} + {onEmoteRemove && (