Skip to content

Commit

Permalink
[Modify] Modify stories
Browse files Browse the repository at this point in the history
  • Loading branch information
jagaapple committed Mar 21, 2020
1 parent f26cbbf commit 9dc15f9
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 15 deletions.
2 changes: 1 addition & 1 deletion stories/3-advanced-examples/custom-drag-handle.css.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
declare const styles: {
readonly "wrapper": string;
readonly "dropLine": string;
readonly "dragHandle": string;
readonly "item": string;
readonly "placeholder": string;
readonly "dragHandle": string;
readonly "ghost": string;
};
export = styles;
Expand Down
11 changes: 2 additions & 9 deletions stories/3-advanced-examples/kanban.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,15 @@ const renderDropLineElement = (injectedProps: DropLineRendererInjectedProps) =>

export const KanbanComponent = () => {
const [itemEntitiesMapState, setItemEntitiesMapState] = React.useState(initialItemEntitiesMap);
const [isDraggingAnyItemState, setIsDraggingAnyItemState] = React.useState(false);

const createItemElements = React.useCallback(
(items: DummyItem[]) =>
items.map((item, index) => (
<Item key={item.id} identifier={item.id} index={index}>
<div className={classnames(styles.item, { [styles.draggingAny]: isDraggingAnyItemState })}>{item.title}</div>
<div className={styles.item}>{item.title}</div>
</Item>
)),
[isDraggingAnyItemState],
[],
);
const leftItemElements = React.useMemo(() => {
const leftItems = itemEntitiesMapState.get(leftRootItemId)!.children!.map((itemId) => itemEntitiesMapState.get(itemId)!);
Expand Down Expand Up @@ -130,12 +129,7 @@ export const KanbanComponent = () => {
[],
);

const onDragStart = React.useCallback(() => {
setIsDraggingAnyItemState(true);
}, []);
const onDragEnd = React.useCallback((meta: DragEndMeta<DummyItem["id"]>) => {
setIsDraggingAnyItemState(false);

if (meta.groupIdentifier === meta.nextGroupIdentifier && meta.index === meta.nextIndex) return;

const newMap = new Map(itemEntitiesMapState.entries());
Expand Down Expand Up @@ -179,7 +173,6 @@ export const KanbanComponent = () => {
renderStackedGroup={renderStackedGroupElement}
draggingCursorStyle="grabbing"
itemSpacing={10}
onDragStart={onDragStart}
onDragEnd={onDragEnd}
>
<Item identifier={leftRootItem.id} index={0} isLocked isGroup isLonely>
Expand Down
4 changes: 0 additions & 4 deletions stories/3-advanced-examples/kanban.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@
.item.placeholder {
color: white;
background-color: #cfdce5;
cursor: grabbing;
}
.item.draggingAny {
cursor: grabbing;
}

.ghost {
Expand Down
1 change: 0 additions & 1 deletion stories/3-advanced-examples/kanban.css.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ declare const styles: {
readonly "items": string;
readonly "item": string;
readonly "placeholder": string;
readonly "draggingAny": string;
readonly "ghost": string;
};
export = styles;
Expand Down

0 comments on commit 9dc15f9

Please sign in to comment.