From 821f1e158263b24efe387d3ccae658802106dbed Mon Sep 17 00:00:00 2001 From: Eric Olkowski Date: Thu, 9 Jan 2025 14:00:36 -0500 Subject: [PATCH 1/2] chore(DataList): added Actionable demo --- .../DataList/examples/DataListActionable.tsx | 128 ++++++++++++++++++ packages/react-core/src/demos/DataListDemo.md | 5 + 2 files changed, 133 insertions(+) create mode 100644 packages/react-core/src/demos/DataList/examples/DataListActionable.tsx 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..f822097e180 --- /dev/null +++ b/packages/react-core/src/demos/DataList/examples/DataListActionable.tsx @@ -0,0 +1,128 @@ +import React from 'react'; +import { + Button, + Content, + DataList, + DataListItem, + DataListCell, + DataListItemRow, + DataListItemCells, + DataListAction, + Dropdown, + DropdownList, + DropdownItem, + MenuToggle, + MenuToggleElement, + PageSection, + PageSectionVariants, + 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 From dc0a1e462af84e993e4de6e121d9b922f394bb39 Mon Sep 17 00:00:00 2001 From: Eric Olkowski Date: Fri, 10 Jan 2025 08:22:47 -0500 Subject: [PATCH 2/2] Removed page section styling, added page section --- .../DataList/examples/DataListActionable.tsx | 148 +++++++++--------- 1 file changed, 77 insertions(+), 71 deletions(-) diff --git a/packages/react-core/src/demos/DataList/examples/DataListActionable.tsx b/packages/react-core/src/demos/DataList/examples/DataListActionable.tsx index f822097e180..7702748c5e5 100644 --- a/packages/react-core/src/demos/DataList/examples/DataListActionable.tsx +++ b/packages/react-core/src/demos/DataList/examples/DataListActionable.tsx @@ -14,7 +14,6 @@ import { MenuToggle, MenuToggleElement, PageSection, - PageSectionVariants, Title } from '@patternfly/react-core'; import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon'; @@ -34,95 +33,102 @@ export const DataListActionable: React.FunctionComponent = () => { return ( - + Projects This is a demo that showcases PatternFly Data List - - {!isDeleted && ( - + + + {!isDeleted && ( + + + + Single actionable Primary content + , + Single actionable Secondary content + ]} + /> + + + + + + )} + - Single actionable Primary content + Multi actions Primary content , - Single actionable Secondary content + Multi actions Secondary content ]} /> - + + Action + {/* Prevent default onClick functionality for example + purposes */} + event.preventDefault()}> + Link + + + Disabled Action + + event.preventDefault()} + > + Disabled Link + + + - )} - - - - 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 - - - - - - - + + ); };