react-beautiful-dnd#DroppableId TypeScript Examples

The following examples show how to use react-beautiful-dnd#DroppableId. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DragndropPostList.tsx    From clearflask with Apache License 2.0 6 votes vote down vote up
DragndropPostListDraggableInner = React.memo((props: {
  providedDraggable: DraggableProvided;
  isDragging: boolean;
  draggingOver?: DroppableId;
  dropAnimation?: DropAnimation;
  content: React.ReactNode;
}) => {
  const classes = useStyles();
  const theme = useTheme();
  return (
    <div
      ref={props.providedDraggable.innerRef}
      {...props.providedDraggable.draggableProps}
      {...props.providedDraggable.dragHandleProps}
      style={patchStyle(theme, props.providedDraggable, props.draggingOver, props.dropAnimation)}
      className={classes.draggable}
    >
      <div className={classNames(
        classes.dragmeIconContainer,
        props.isDragging && classes.dragmeIconContainerDragging,
      )}>
        <DragmeIcon color='inherit' />
      </div>
      {props.content}
    </div>
  );
})
Example #2
Source File: DragndropPostList.tsx    From clearflask with Apache License 2.0 6 votes vote down vote up
patchStyle = (
  theme: Theme,
  providedDraggable: DraggableProvided,
  draggingOver?: DroppableId,
  dropAnimation?: DropAnimation,
) => {
  const style: any = {
    ...(providedDraggable.draggableProps.style || {}),
  };

  if (draggingOver || dropAnimation) {
    style.zIndex = theme.zIndex.tooltip + 1;
  }

  // Animate dropping into quick action droppable as if it was a combine
  // by changing opacity and scale down.
  if (dropAnimation
    && style.transform
    && draggingOver
    && droppableDataDeserialize(draggingOver)?.['dropbox']) {
    // Properties match default combine https://github.com/atlassian/react-beautiful-dnd/blob/2360665305b854434e968e41c7b4105009b73c40/src/animation.js#L18
    style.transform = (style.transform || '') + ' scale(0)';
    style.opacity = 0;
  }

  return style;
}