Skip to content

Commit ae4d6f3

Browse files
authored
chore(Drag and drop): Updated example for multi list to use flex (#10692)
* chore(Drag and drop): Updated example for multilist to use flex so that target list will maintain size when empty * remove null check
1 parent 7d2ad5c commit ae4d6f3

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/react-core/src/components/DragDrop/Draggable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export const Draggable: React.FunctionComponent<DraggableProps> = ({
117117
index
118118
};
119119
const dest =
120-
hoveringDroppableId !== null && hoveringIndex !== null
120+
hoveringDroppableId !== null
121121
? {
122122
droppableId: hoveringDroppableId,
123123
index: hoveringIndex

packages/react-core/src/components/DragDrop/examples/DragDropMultipleLists.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { DragDrop, Draggable, Droppable, Split, SplitItem } from '@patternfly/react-core';
2+
import { DragDrop, Draggable, Droppable, Flex } from '@patternfly/react-core';
33

44
interface ItemType {
55
id: string;
@@ -85,19 +85,19 @@ export const DragDropMultipleLists: React.FunctionComponent = () => {
8585

8686
return (
8787
<DragDrop onDrop={onDrop}>
88-
<Split hasGutter>
88+
<Flex alignItems={{ default: 'alignItemsStretch' }} flexWrap={{ default: 'nowrap' }}>
8989
{Object.entries(items).map(([key, subitems]) => (
90-
<SplitItem key={key} style={{ flex: 1 }}>
91-
<Droppable zone="multizone" droppableId={key}>
90+
<Flex key={key} fullWidth={{ default: 'fullWidth' }} alignItems={{ default: 'alignItemsStretch' }}>
91+
<Droppable zone="multizone" droppableId={key} style={{ flexGrow: '1' }}>
9292
{(subitems as ItemType[]).map(({ id, content }) => (
9393
<Draggable key={id} style={{ padding: '8px' }}>
9494
{content}
9595
</Draggable>
9696
))}
9797
</Droppable>
98-
</SplitItem>
98+
</Flex>
9999
))}
100-
</Split>
100+
</Flex>
101101
</DragDrop>
102102
);
103103
};

0 commit comments

Comments
 (0)