Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(DragDropSort): update drag button usage v5 #10357

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ export const DragDropSort: React.FunctionComponent<DragDropSortProps> = ({
break;
default:
content = (
<Draggable useDragButton={variant === 'defaultWithHandle'} key={item.id} id={item.id} {...item.props}>
<Draggable
useDragButton={variant === 'defaultWithHandle' || variant === 'default'}
key={item.id}
id={item.id}
{...item.props}
>
{item.content}
</Draggable>
);
Expand Down Expand Up @@ -157,7 +162,12 @@ export const DragDropSort: React.FunctionComponent<DragDropSortProps> = ({
);
default:
return (
<Draggable useDragButton={variant === 'defaultWithHandle'} key={item.id} id={item.id} {...item.props}>
<Draggable
useDragButton={variant === 'defaultWithHandle' || variant === 'default'}
key={item.id}
id={item.id}
{...item.props}
>
{item.content}
</Draggable>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,99 @@ exports[`renders some divs 1`] = `
>
<div>
<div
aria-describedby="DndDescribedBy-0"
aria-disabled="false"
aria-roledescription="sortable"
class=""
role="button"
tabindex="0"
>
<button
aria-describedby="DndDescribedBy-0"
aria-disabled="false"
aria-label="Drag button"
aria-roledescription="sortable"
class="pf-v5-c-button pf-m-plain"
role="button"
tabindex="0"
>
<span
class="pf-v5-c-data-list__item-draggable-icon"
>
<svg
aria-hidden="true"
class="pf-v5-svg"
fill="currentColor"
height="1em"
role="img"
viewBox="0 0 320 512"
width="1em"
>
<path
d="M96 32H32C14.33 32 0 46.33 0 64v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zM288 32h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32z"
/>
</svg>
</span>
</button>
one
</div>
<div
aria-describedby="DndDescribedBy-0"
aria-disabled="false"
aria-roledescription="sortable"
class=""
role="button"
tabindex="0"
>
<button
aria-describedby="DndDescribedBy-0"
aria-disabled="false"
aria-label="Drag button"
aria-roledescription="sortable"
class="pf-v5-c-button pf-m-plain"
role="button"
tabindex="0"
>
<span
class="pf-v5-c-data-list__item-draggable-icon"
>
<svg
aria-hidden="true"
class="pf-v5-svg"
fill="currentColor"
height="1em"
role="img"
viewBox="0 0 320 512"
width="1em"
>
<path
d="M96 32H32C14.33 32 0 46.33 0 64v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zM288 32h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32z"
/>
</svg>
</span>
</button>
two
</div>
<div
aria-describedby="DndDescribedBy-0"
aria-disabled="false"
aria-roledescription="sortable"
class=""
role="button"
tabindex="0"
>
<button
aria-describedby="DndDescribedBy-0"
aria-disabled="false"
aria-label="Drag button"
aria-roledescription="sortable"
class="pf-v5-c-button pf-m-plain"
role="button"
tabindex="0"
>
<span
class="pf-v5-c-data-list__item-draggable-icon"
>
<svg
aria-hidden="true"
class="pf-v5-svg"
fill="currentColor"
height="1em"
role="img"
viewBox="0 0 320 512"
width="1em"
>
<path
d="M96 32H32C14.33 32 0 46.33 0 64v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zM288 32h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32z"
/>
</svg>
</span>
</button>
three
</div>
</div>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export const BasicSortingWithDragButton: React.FunctionComponent = () => {
return (
<DragDropSort
items={items}
variant="defaultWithHandle"
onDrop={(_, newItems) => {
setItems(newItems);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ import { DragDropSort } from '@patternfly/react-drag-drop';

### Basic drag and drop sorting

```ts file="./BasicSorting.tsx"

```

### Basic drag and drop sorting with drag button

```ts file="./BasicSortingWithDragButton.tsx"

```
Loading