minop1205 / react-dnd-treeview

A draggable / droppable React-based treeview component. You can use render props to create each node freely.
MIT License
530 stars 71 forks source link

Feature Request: Allow styling of the listItemComponent #59

Closed jannnik closed 3 years ago

jannnik commented 3 years ago

Feature request

Summary

Allow styling of the listItemComponent when it is not a dragSource or dropTarget.

Purpose / Reason

We want to add a dashed 1px border to the listItemComponent when it is a dropTarget. To prevent the items from jumping around while dragging, we also need to add a transparent 1px border to all listItemComponents. Unfortunately, it is not possible to style the listItemComponent via the classes property.

If you have an implementation idea.

Allow setting default styles of the listItemComponent via the classes property.

Reference information

https://github.com/minop1205/react-dnd-treeview#component-styling

image

minop1205 commented 3 years ago

@jannnik Thank you for the feature request.

I have just implemented the feature in the following CodeSandbox, is it working as you intended?

https://codesandbox.io/s/full-features-issue-59-twpze

I made it possible to specify classes.listItem. I also specified classes.root to have the same effect for dropping to the root.

The following two files are related to this feature. https://codesandbox.io/s/full-features-issue-59-twpze?file=/src/App.tsx https://codesandbox.io/s/full-features-issue-59-twpze?file=/src/App.module.css

If this is OK, publish it as v1.5.3.

jannnik commented 3 years ago

@minop1205 Great, it works as expected! Thank you!

minop1205 commented 3 years ago

@jannnik Thank you your verification! I merged it and published as v1.5.3

https://github.com/minop1205/react-dnd-treeview/pull/60