2
0

feat(editor): ️ Improve previewing blocks

This commit is contained in:
Baptiste Arnaud
2022-04-02 12:03:21 +02:00
parent 05009814d4
commit 327da3104d
3 changed files with 46 additions and 35 deletions

View File

@ -51,6 +51,7 @@ export const StepNode = ({
openedStepId,
setOpenedStepId,
setFocusedBlockId,
previewingEdge,
} = useGraph()
const { updateStep } = useTypebot()
const [isConnecting, setIsConnecting] = useState(false)
@ -62,6 +63,8 @@ export const StepNode = ({
)
const stepRef = useRef<HTMLDivElement | null>(null)
const isPreviewing = isConnecting || previewingEdge?.to.stepId === step.id
const onDrag = (position: NodePosition) => {
if (step.type === 'start' || !onMouseDown) return
onMouseDown(position, step)
@ -170,8 +173,9 @@ export const StepNode = ({
flex="1"
userSelect="none"
p="3"
borderWidth="1px"
borderColor={isConnecting || isOpened ? 'blue.400' : 'gray.200'}
borderWidth={isOpened || isPreviewing ? '2px' : '1px'}
borderColor={isOpened || isPreviewing ? 'blue.400' : 'gray.200'}
margin={isOpened || isPreviewing ? '-1px' : 0}
rounded="lg"
cursor={'pointer'}
bgColor="gray.50"