bmcmahen / react-grid-dnd

drag and drop, grid edition. built with react

Home Page:https://codesandbox.io/embed/gracious-wozniak-kj9w8

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

2.1.2 GridItem className not set

rsmarsh opened this issue · comments

In 2.1.2 the className which is added to each GridItem, along with 'dragging' or 'disabled' is no longer functioning due to a jumbled ternary

This can be seen by taking the codesandbox demo from this repo's README, and bumping the react-grid-dnd version number up to 2.1.2, then inspect the div element wrapping each grid item (as seen here). You will see that the div now has a className of 'undefined', and when dragging, the 'dragging' class is not appended
image

I have created a pull request #28 with an example fix for this.

commented

Issue is still present, easy to fix
you need to add parenthesis because className conditional statement clears out content that is added before it.
GridItem.tsx line 143

className:
      "GridItem" +
      (isDragging ? " dragging" : "") +
      (!!disableDrag ? " disabled" : "") +
      (className
        ? ` ${className}`
        : ""),

I can create PR