diff --git a/packages/react-core/src/demos/DescriptionList/DescriptionList.md b/packages/react-core/src/demos/DescriptionList/DescriptionList.md new file mode 100644 index 00000000000..b0ad5b511a7 --- /dev/null +++ b/packages/react-core/src/demos/DescriptionList/DescriptionList.md @@ -0,0 +1,14 @@ +--- +id: Description list +section: components +--- + +import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon'; +import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper'; + +## Demos + +### In drawer + +```js file='./examples/DescriptionListDrawer.tsx' isFullscreen +``` \ No newline at end of file diff --git a/packages/react-core/src/demos/DescriptionList/examples/DescriptionListDrawer.tsx b/packages/react-core/src/demos/DescriptionList/examples/DescriptionListDrawer.tsx new file mode 100644 index 00000000000..c258a3ce938 --- /dev/null +++ b/packages/react-core/src/demos/DescriptionList/examples/DescriptionListDrawer.tsx @@ -0,0 +1,167 @@ +import React from 'react'; +import { + Gallery, + PageSection, + GalleryItem, + Card, + CardBody, + DrawerHead, + DrawerActions, + DrawerCloseButton, + PageSectionVariants, + TextContent, + Text, + DrawerPanelBody, + DescriptionList, + DescriptionListTerm, + DescriptionListGroup, + DescriptionListDescription, + Button, + Page, + Title +} from '@patternfly/react-core'; +import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper'; +import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon'; + +export const DescriptionListDrawer: React.FunctionComponent = () => { + const drawerRef = React.useRef(null); + const btnRef = React.useRef(null); + const [isExpanded, setIsExpanded] = React.useState(true); + + const onExpand = () => { + drawerRef.current && drawerRef.current.focus(); + }; + + const onCloseClick = () => { + setIsExpanded(false); + btnRef.current && btnRef.current.focus(); + }; + + const onOpenDrawer = () => { + setIsExpanded(true); + }; + + const panelContent = ( + <> + + + <span ref={drawerRef} tabIndex={isExpanded ? 0 : -1}> + test + </span> + + + + + + + + + Name + test + + + Namespace + + mary-test + + + + Labels + app=test + + + Pod selector + Node selector is not available at this time + + + Tolerations + No tolerations + + + Annotations + No annotaions + + + Status + Active + + + Created at: + 3 minutes agot + + + Pod selector + + + + + + Session affinity + None + + + Latest version + 1.0 + + + Update strategy + Rolling + + + Timeout + 600 seconds + + + Max available + 25% of 1 pod + + + Max surge + 25% greater than 1 pod + + + + + ); + + const drawerContent = ( + + + + + + + + + {Array.from({ length: 30 }).map((_value, index) => ( + + + {`Card-${index + 1}`} + + + ))} + + ); + + return ( + + + + + Main title + This is a full page demo. + + + {drawerContent} + + + ); +};