Skip to content

Commit 495e521

Browse files
committed
Update package version to 1.0.172 and add activeItemId prop to DraggableList
1 parent 125b6ab commit 495e521

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@programmer_network/yail",
3-
"version": "1.0.171",
3+
"version": "1.0.172",
44
"description": "Programmer Network's official UI library for React",
55
"author": "Aleksandar Grbic - (https://programmer.network)",
66
"publishConfig": {

src/Components/DraggableList/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const DraggableList: FC<IDraggableList> = ({
1212
draggedClassName,
1313
draggedOverClassName,
1414
liClassName,
15+
activeItemId,
1516
onSorted,
1617
onClick
1718
}) => {
@@ -20,7 +21,6 @@ const DraggableList: FC<IDraggableList> = ({
2021
const [hoveredId, setHoveredId] = useState<number | null>(null);
2122
const [listItems, setListItems] = useState<IDraggableListItem[]>(items);
2223
const [isSorting, setIsSorting] = useState<boolean>(false);
23-
const [activeId, setActiveId] = useState<number | null>(null);
2424

2525
const canDrag = isDraggable && !isSorting && items.length > 1;
2626

@@ -90,7 +90,7 @@ const DraggableList: FC<IDraggableList> = ({
9090
[draggedOverClassName ?? ""]:
9191
!isSorting && draggedOverId === item.id,
9292
"yl-opacity-30": isSorting && draggedId !== item.id,
93-
"yl-text-primary": activeId === item.id
93+
"yl-text-primary": activeItemId === item.id
9494
}
9595
)}
9696
draggable={canDrag}
@@ -100,7 +100,6 @@ const DraggableList: FC<IDraggableList> = ({
100100
onMouseOver={() => (canDrag ? setHoveredId(item.id) : null)}
101101
onMouseLeave={() => (canDrag ? setHoveredId(null) : null)}
102102
onClick={() => {
103-
setActiveId(item.id);
104103
onClick?.(item);
105104
}}
106105
>

src/Components/DraggableList/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ export interface IDraggableList {
1313
items: IDraggableListItem[];
1414
onSorted?: (items: IDraggableListItem[]) => Promise<unknown>;
1515
onClick?: (item: IDraggableListItem) => void;
16+
activeItemId?: number;
1617
ListItemComponent?: React.FC<IDraggableListItem>;
1718
}

0 commit comments

Comments
 (0)