From b92a0c9f646be4479c204f2277432ae9048d1e46 Mon Sep 17 00:00:00 2001 From: Gabi Podolnikova Date: Wed, 24 Nov 2021 15:16:31 +0100 Subject: [PATCH 1/3] chore(Tabs): added nested Tabs demo --- packages/react-core/src/demos/Tabs.md | 129 ++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) diff --git a/packages/react-core/src/demos/Tabs.md b/packages/react-core/src/demos/Tabs.md index a67309a67dc..7e5668ad580 100644 --- a/packages/react-core/src/demos/Tabs.md +++ b/packages/react-core/src/demos/Tabs.md @@ -437,3 +437,132 @@ TabsOpenWithSecondaryTabsDemo = () => { ); }; ``` + +### Open nested tabs + +```js isFullscreen +import React from 'react'; +import { + Card, + CardHeader, + CardBody, + Grid, + GridItem, + PageSection, + PageSectionVariants, + Tabs, + Tab, + TabContent, + TabContentBody, + TabTitleText, + Title, + Label, + LabelGroup, + Flex, + FlexItem +} from '@patternfly/react-core'; +import DashboardWrapper from './examples/DashboardWrapper'; +import CheckCircleIcon from '@patternfly/react-icons/dist/js/icons/check-circle-icon'; +import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon'; + +TabsOpenNestedDemo = () => { + const [activeTabKey, setActiveTabKey] = React.useState(0); + const [activeNestedTabKey, setActiveNestedTabKey] = React.useState(10); + + // Toggle currently active tab + const handleTabClick = (event, tabIndex) => + setActiveTabKey(tabIndex); + + // Toggle currently active nested tab + const handleNestedTabClick = (event, tabIndex) => + setActiveNestedTabKey(tabIndex); + + const tabContent = ( + + + + + + Status + + + + + + + Cluster} tabContentId={`tabContent${10}`} /> + Control plane} tabContentId={`tabContent${11}`} /> + Operators} tabContentId={`tabContent${12}`} /> + Virtualization} tabContentId={`tabContent${13}`} /> + + + + + + + + + + + + + + + + + + + Title of Card + + + + + + + + + Title of Card + + + + + + + + ); + + return ( + + + + Overview + + + + + Cluster 1} tabContentId={`tabContent${0}`} /> + Cluster 2} tabContentId={`tabContent${1}`} /> + + + + + + + + ); +}; +``` \ No newline at end of file From 4eb8dc088b362223d8e68ba277a037d9ac53d22d Mon Sep 17 00:00:00 2001 From: Gabi Podolnikova Date: Tue, 30 Nov 2021 15:32:55 +0100 Subject: [PATCH 2/3] fixing few style issues --- packages/react-core/src/demos/Tabs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-core/src/demos/Tabs.md b/packages/react-core/src/demos/Tabs.md index 7e5668ad580..4de16878557 100644 --- a/packages/react-core/src/demos/Tabs.md +++ b/packages/react-core/src/demos/Tabs.md @@ -489,7 +489,7 @@ TabsOpenNestedDemo = () => { - + Cluster} tabContentId={`tabContent${10}`} /> Control plane} tabContentId={`tabContent${11}`} /> Operators} tabContentId={`tabContent${12}`} /> @@ -554,7 +554,7 @@ TabsOpenNestedDemo = () => { Cluster 2} tabContentId={`tabContent${1}`} /> - + From 914d251b222537706a44345072d0a57f9551c9ae Mon Sep 17 00:00:00 2001 From: Gabi Podolnikova Date: Thu, 2 Dec 2021 13:50:47 +0100 Subject: [PATCH 3/3] Fixed formatting --- packages/react-core/src/demos/Tabs.md | 129 +-------------- .../src/demos/Tabs/NestedTabsDemo.js | 151 ++++++++++++++++++ 2 files changed, 153 insertions(+), 127 deletions(-) create mode 100644 packages/react-core/src/demos/Tabs/NestedTabsDemo.js diff --git a/packages/react-core/src/demos/Tabs.md b/packages/react-core/src/demos/Tabs.md index 4de16878557..1709c39e379 100644 --- a/packages/react-core/src/demos/Tabs.md +++ b/packages/react-core/src/demos/Tabs.md @@ -438,131 +438,6 @@ TabsOpenWithSecondaryTabsDemo = () => { }; ``` -### Open nested tabs - -```js isFullscreen -import React from 'react'; -import { - Card, - CardHeader, - CardBody, - Grid, - GridItem, - PageSection, - PageSectionVariants, - Tabs, - Tab, - TabContent, - TabContentBody, - TabTitleText, - Title, - Label, - LabelGroup, - Flex, - FlexItem -} from '@patternfly/react-core'; -import DashboardWrapper from './examples/DashboardWrapper'; -import CheckCircleIcon from '@patternfly/react-icons/dist/js/icons/check-circle-icon'; -import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon'; - -TabsOpenNestedDemo = () => { - const [activeTabKey, setActiveTabKey] = React.useState(0); - const [activeNestedTabKey, setActiveNestedTabKey] = React.useState(10); - - // Toggle currently active tab - const handleTabClick = (event, tabIndex) => - setActiveTabKey(tabIndex); - - // Toggle currently active nested tab - const handleNestedTabClick = (event, tabIndex) => - setActiveNestedTabKey(tabIndex); - - const tabContent = ( - - - - - - Status - - - - - - - Cluster} tabContentId={`tabContent${10}`} /> - Control plane} tabContentId={`tabContent${11}`} /> - Operators} tabContentId={`tabContent${12}`} /> - Virtualization} tabContentId={`tabContent${13}`} /> - - - - - - - - - - - - - - - - - - - Title of Card - - - - - - - - - Title of Card - - - - - - - - ); - - return ( - - - - Overview - - - - - Cluster 1} tabContentId={`tabContent${0}`} /> - Cluster 2} tabContentId={`tabContent${1}`} /> - - - - - - - - ); -}; +### Nested tabs +```js isFullscreen file="./Tabs/NestedTabsDemo.js" ``` \ No newline at end of file diff --git a/packages/react-core/src/demos/Tabs/NestedTabsDemo.js b/packages/react-core/src/demos/Tabs/NestedTabsDemo.js new file mode 100644 index 00000000000..66d3bbc482d --- /dev/null +++ b/packages/react-core/src/demos/Tabs/NestedTabsDemo.js @@ -0,0 +1,151 @@ +import React from 'react'; +import { + Card, + CardHeader, + CardBody, + Grid, + GridItem, + PageSection, + PageSectionVariants, + Tabs, + Tab, + TabContent, + TabContentBody, + TabTitleText, + Title, + Flex, + FlexItem +} from '@patternfly/react-core'; +import DashboardWrapper from '../examples/DashboardWrapper'; + +export const NestedTabsDemo = () => { + const [activeTabKey, setActiveTabKey] = React.useState(0); + const [activeNestedTabKey, setActiveNestedTabKey] = React.useState(10); + + // Toggle currently active tab + const handleTabClick = (_, tabIndex) => setActiveTabKey(tabIndex); + + // Toggle currently active nested tab + const handleNestedTabClick = (_, tabIndex) => setActiveNestedTabKey(tabIndex); + + const tabContent = ( + + + + + Status + + + + + + Cluster} tabContentId={`tabContent${10}`} /> + Control plane} + tabContentId={`tabContent${11}`} + /> + Operators} tabContentId={`tabContent${12}`} /> + Virtualization} + tabContentId={`tabContent${13}`} + /> + + + + + + + + + + + + + + + + + + Title of Card + + + + + + + Title of Card + + + + + + + ); + + return ( + + + + Overview + + + + + Cluster 1} tabContentId={`tabContent${0}`} /> + Cluster 2} tabContentId={`tabContent${1}`} /> + + + + + + + + ); +};