diff --git a/packages/react-core/src/demos/DataList/examples/DataListActionable.tsx b/packages/react-core/src/demos/DataList/examples/DataListActionable.tsx new file mode 100644 index 00000000000..7702748c5e5 --- /dev/null +++ b/packages/react-core/src/demos/DataList/examples/DataListActionable.tsx @@ -0,0 +1,134 @@ +import React from 'react'; +import { + Button, + Content, + DataList, + DataListItem, + DataListCell, + DataListItemRow, + DataListItemCells, + DataListAction, + Dropdown, + DropdownList, + DropdownItem, + MenuToggle, + MenuToggleElement, + PageSection, + Title +} from '@patternfly/react-core'; +import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon'; +import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper'; + +export const DataListActionable: React.FunctionComponent = () => { + const [isOpen, setIsOpen] = React.useState(false); + const [isDeleted, setIsDeleted] = React.useState(false); + + const onToggle = () => { + setIsOpen(!isOpen); + }; + + const onSelect = () => { + setIsOpen(!isOpen); + }; + + return ( + + + + Projects + This is a demo that showcases PatternFly Data List + + + + + {!isDeleted && ( + + + + Single actionable Primary content + , + Single actionable Secondary content + ]} + /> + + + + + + )} + + + + Multi actions Primary content + , + Multi actions Secondary content + ]} + /> + + ) => ( + + + )} + isOpen={isOpen} + onOpenChange={(isOpen: boolean) => setIsOpen(isOpen)} + > + + Action + {/* Prevent default onClick functionality for example + purposes */} + event.preventDefault()}> + Link + + + Disabled Action + + event.preventDefault()} + > + Disabled Link + + + + + + + + + + ); +}; diff --git a/packages/react-core/src/demos/DataListDemo.md b/packages/react-core/src/demos/DataListDemo.md index bd8b0b47320..0449f8cdaff 100644 --- a/packages/react-core/src/demos/DataListDemo.md +++ b/packages/react-core/src/demos/DataListDemo.md @@ -30,6 +30,11 @@ import { rows } from '@patternfly/react-core/dist/esm/demos/sampleData'; ```js file="./DataList/examples/DataListExpandableControlInToolbar.tsx" isFullscreen ``` +### Actionable + +```js file="./DataList/examples/DataListActionable.tsx" isFullscreen +``` + ### Static bottom pagination ```js file="./DataList/examples/DataListStaticBottomPagination.tsx" isFullscreen