mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-08 22:39:36 +08:00
fix: Improve DragableList component styling and placeholder handling
This commit is contained in:
parent
b2c6662192
commit
de76d3fedc
@ -46,23 +46,28 @@ const DragableList: FC<Props<any>> = ({
|
|||||||
<DragDropContext onDragStart={onDragStart} onDragEnd={_onDragEnd}>
|
<DragDropContext onDragStart={onDragStart} onDragEnd={_onDragEnd}>
|
||||||
<Droppable droppableId="droppable" {...droppableProps}>
|
<Droppable droppableId="droppable" {...droppableProps}>
|
||||||
{(provided) => (
|
{(provided) => (
|
||||||
<div {...provided.droppableProps} ref={provided.innerRef} style={{ ...style }}>
|
<div {...provided.droppableProps} ref={provided.innerRef} style={style}>
|
||||||
{list.map((item, index) => {
|
{list.map((item, index) => {
|
||||||
const id = item.id || item
|
const id = item.id || item
|
||||||
return (
|
return (
|
||||||
<Draggable key={`draggable_${id}_${index}`} draggableId={id} index={index} {...droppableProps}>
|
<Draggable key={`draggable_${id}_${index}`} draggableId={id} index={index}>
|
||||||
{(provided) => (
|
{(provided, snapshot) => (
|
||||||
<div
|
<div
|
||||||
ref={provided.innerRef}
|
ref={provided.innerRef}
|
||||||
{...provided.draggableProps}
|
{...provided.draggableProps}
|
||||||
{...provided.dragHandleProps}
|
{...provided.dragHandleProps}
|
||||||
style={{ ...provided.draggableProps.style, marginBottom: 8, ...listStyle }}>
|
style={{
|
||||||
|
...listStyle,
|
||||||
|
...provided.draggableProps.style,
|
||||||
|
marginBottom: index === list.length - 1 && !snapshot.isDragging ? 0 : 8
|
||||||
|
}}>
|
||||||
{children(item, index)}
|
{children(item, index)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Draggable>
|
</Draggable>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
|
{provided.placeholder}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Droppable>
|
</Droppable>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user