| 1 |
import { css } from '@patternfly/react-styles'; |
| 2 |
import styles from '@patternfly/react-styles/css/components/DataList/data-list'; |
| 3 |
import RhUiGripVerticalFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-grip-vertical-fill-icon'; |
| 4 |
|
| 5 |
export interface DataListDragButtonProps extends React.HTMLProps<HTMLButtonElement> { |
| 6 |
/** Additional classes added to the drag button */ |
| 7 |
className?: string; |
| 8 |
/** Sets button type */ |
| 9 |
type?: 'button' | 'submit' | 'reset'; |
| 10 |
/** Flag indicating if drag is disabled for the item */ |
| 11 |
isDisabled?: boolean; |
| 12 |
} |
| 13 |
|
| 14 |
export const DataListDragButton: React.FunctionComponent<DataListDragButtonProps> = ({ |
| 15 |
className = '', |
| 16 |
isDisabled = false, |
| 17 |
...props |
| 18 |
}: DataListDragButtonProps) => ( |
| 19 |
<button |
| 20 |
className={css(styles.dataListItemDraggableButton, isDisabled && styles.modifiers.disabled, className)} |
| 21 |
type="button" |
| 22 |
disabled={isDisabled} |
| 23 |
{...props} |
| 24 |
> |
| 25 |
<span className={css(styles.dataListItemDraggableIcon)}> |
| 26 |
<RhUiGripVerticalFillIcon /> |
| 27 |
</span> |
| 28 |
</button> |
| 29 |
); |
| 30 |
DataListDragButton.displayName = 'DataListDragButton'; |