Skip to content

Commit e4012ac

Browse files
committed
chore: Update package version to 1.0.176 and fix Accordion onDragged event handler
1 parent 9f79e44 commit e4012ac

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
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.175",
3+
"version": "1.0.176",
44
"description": "Programmer Network's official UI library for React",
55
"author": "Aleksandar Grbic - (https://programmer.network)",
66
"publishConfig": {

src/Components/Accordion/index.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ const Accordion: FC<IAccordionProps> = ({
5858
sections,
5959
sections.findIndex(item => item.id === draggedId),
6060
sections.findIndex(item => item.id === draggedOverId)
61-
)
61+
),
62+
{ sectionId: draggedId, items: [] }
6263
);
6364
}
6465

@@ -132,11 +133,14 @@ const Accordion: FC<IAccordionProps> = ({
132133
<DraggableList
133134
items={section.items}
134135
onDragged={(items: IDraggableListItem[]) => {
135-
setSections([
136-
...sections.map(s =>
137-
s.id === section.id ? { ...s, items } : s
138-
)
139-
]);
136+
setSections(
137+
[
138+
...sections.map(s =>
139+
s.id === section.id ? { ...s, items } : s
140+
)
141+
],
142+
{ sectionId: section.id, items }
143+
);
140144
}}
141145
isDraggable={hasDraggableSectionItems}
142146
className='yl-gap-4 yl-flex yl-flex-col yl-py-4'

src/Components/Accordion/types.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ export enum AccordionOrderType {
2222
export interface IAccordionProps {
2323
className?: string;
2424
sections: ISection[];
25-
setSections: (sections: ISection[]) => void;
25+
setSections: (
26+
sections: ISection[],
27+
section: { sectionId: number; items: IDraggableListItem[] }
28+
) => void;
2629
sectionTitleClassName?: string;
2730
onSectionItemClick?: (item: IDraggableListItem) => void;
2831
onSectionClick?: (item: IDraggableListItem) => void;

0 commit comments

Comments
 (0)