File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed
src/Components/DraggableList Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @programmer_network/yail" ,
3
- "version" : " 1.0.171 " ,
3
+ "version" : " 1.0.172 " ,
4
4
"description" : " Programmer Network's official UI library for React" ,
5
5
"author" : " Aleksandar Grbic - (https://programmer.network)" ,
6
6
"publishConfig" : {
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ const DraggableList: FC<IDraggableList> = ({
12
12
draggedClassName,
13
13
draggedOverClassName,
14
14
liClassName,
15
+ activeItemId,
15
16
onSorted,
16
17
onClick
17
18
} ) => {
@@ -20,7 +21,6 @@ const DraggableList: FC<IDraggableList> = ({
20
21
const [ hoveredId , setHoveredId ] = useState < number | null > ( null ) ;
21
22
const [ listItems , setListItems ] = useState < IDraggableListItem [ ] > ( items ) ;
22
23
const [ isSorting , setIsSorting ] = useState < boolean > ( false ) ;
23
- const [ activeId , setActiveId ] = useState < number | null > ( null ) ;
24
24
25
25
const canDrag = isDraggable && ! isSorting && items . length > 1 ;
26
26
@@ -90,7 +90,7 @@ const DraggableList: FC<IDraggableList> = ({
90
90
[ draggedOverClassName ?? "" ] :
91
91
! isSorting && draggedOverId === item . id ,
92
92
"yl-opacity-30" : isSorting && draggedId !== item . id ,
93
- "yl-text-primary" : activeId === item . id
93
+ "yl-text-primary" : activeItemId === item . id
94
94
}
95
95
) }
96
96
draggable = { canDrag }
@@ -100,7 +100,6 @@ const DraggableList: FC<IDraggableList> = ({
100
100
onMouseOver = { ( ) => ( canDrag ? setHoveredId ( item . id ) : null ) }
101
101
onMouseLeave = { ( ) => ( canDrag ? setHoveredId ( null ) : null ) }
102
102
onClick = { ( ) => {
103
- setActiveId ( item . id ) ;
104
103
onClick ?.( item ) ;
105
104
} }
106
105
>
Original file line number Diff line number Diff line change @@ -13,5 +13,6 @@ export interface IDraggableList {
13
13
items : IDraggableListItem [ ] ;
14
14
onSorted ?: ( items : IDraggableListItem [ ] ) => Promise < unknown > ;
15
15
onClick ?: ( item : IDraggableListItem ) => void ;
16
+ activeItemId ?: number ;
16
17
ListItemComponent ?: React . FC < IDraggableListItem > ;
17
18
}
You can’t perform that action at this time.
0 commit comments