| 1 |
import { useState } from 'react'; |
| 2 |
import { |
| 3 |
Card, |
| 4 |
CardHeader, |
| 5 |
CardBody, |
| 6 |
Content, |
| 7 |
Grid, |
| 8 |
GridItem, |
| 9 |
PageSection, |
| 10 |
Tabs, |
| 11 |
Tab, |
| 12 |
TabContent, |
| 13 |
TabContentBody, |
| 14 |
TabTitleText, |
| 15 |
Title, |
| 16 |
TitleSizes, |
| 17 |
CardTitle |
| 18 |
} from '@patternfly/react-core'; |
| 19 |
import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper'; |
| 20 |
|
| 21 |
export const NestedUnindentedTabs: React.FunctionComponent = () => { |
| 22 |
const [activeTabKey, setActiveTabKey] = useState(1); |
| 23 |
const [activeNestedTabKey, setActiveNestedTabKey] = useState(10); |
| 24 |
|
| 25 |
// Toggle currently active tab |
| 26 |
const handleTabClick = (tabIndex: number) => setActiveTabKey(tabIndex); |
| 27 |
|
| 28 |
// Toggle currently active nested tab |
| 29 |
const handleNestedTabClick = (tabIndex: number) => setActiveNestedTabKey(tabIndex); |
| 30 |
|
| 31 |
const tabContent = ( |
| 32 |
<Grid hasGutter> |
| 33 |
<GridItem> |
| 34 |
<CardHeader> |
| 35 |
<Title headingLevel="h1" size={TitleSizes.lg}> |
| 36 |
Get started with Red Hat Enterprise Linux |
| 37 |
</Title> |
| 38 |
</CardHeader> |
| 39 |
</GridItem> |
| 40 |
<GridItem> |
| 41 |
<Tabs |
| 42 |
activeKey={activeNestedTabKey} |
| 43 |
onSelect={(_event, tabIndex) => handleNestedTabClick(Number(tabIndex))} |
| 44 |
id="nested-tabs-example-nested-tabs-list" |
| 45 |
> |
| 46 |
<Tab eventKey={10} title={<TabTitleText>x86 architecture</TabTitleText>} tabContentId={`tabContent${10}`} /> |
| 47 |
<Tab |
| 48 |
eventKey={11} |
| 49 |
title={<TabTitleText>Additional Architectures</TabTitleText>} |
| 50 |
tabContentId={`tabContent${11}`} |
| 51 |
/> |
| 52 |
</Tabs> |
| 53 |
</GridItem> |
| 54 |
<GridItem> |
| 55 |
<TabContent |
| 56 |
key={10} |
| 57 |
eventKey={10} |
| 58 |
id={`tabContent${10}`} |
| 59 |
activeKey={activeNestedTabKey} |
| 60 |
hidden={10 !== activeNestedTabKey} |
| 61 |
> |
| 62 |
<TabContentBody> |
| 63 |
<Grid hasGutter> |
| 64 |
<GridItem> |
| 65 |
<Content component="p"> |
| 66 |
To perform a standard x86_64 installation using the GUI, you'll need to: |
| 67 |
</Content> |
| 68 |
</GridItem> |
| 69 |
<Grid md={6} xl2={3} hasGutter> |
| 70 |
<Card component="div"> |
| 71 |
<CardTitle>Check system requirements</CardTitle> |
| 72 |
<CardBody> |
| 73 |
Your physical or virtual machine should meet the <a href="#">system requirement</a>. |
| 74 |
</CardBody> |
| 75 |
</Card> |
| 76 |
<Card component="div"> |
| 77 |
<CardTitle>Download an installation ISO image</CardTitle> |
| 78 |
<CardBody> |
| 79 |
{' '} |
| 80 |
<a href="#">Download</a> the binary DVD ISO. |
| 81 |
</CardBody> |
| 82 |
</Card> |
| 83 |
<Card component="div"> |
| 84 |
<CardTitle>Create a bootable installation media</CardTitle> |
| 85 |
<CardBody> |
| 86 |
{' '} |
| 87 |
<a href="#">Create</a> a bootable installation media, for example a USB flash drive. |
| 88 |
</CardBody> |
| 89 |
</Card> |
| 90 |
</Grid> |
| 91 |
</Grid> |
| 92 |
</TabContentBody> |
| 93 |
</TabContent> |
| 94 |
<TabContent |
| 95 |
key={11} |
| 96 |
eventKey={11} |
| 97 |
id={`tabContent${11}`} |
| 98 |
activeKey={activeNestedTabKey} |
| 99 |
hidden={11 !== activeNestedTabKey} |
| 100 |
> |
| 101 |
<TabContentBody>Additional architectures panel</TabContentBody> |
| 102 |
</TabContent> |
| 103 |
<TabContent |
| 104 |
key={12} |
| 105 |
eventKey={12} |
| 106 |
id={`tabContent${12}`} |
| 107 |
activeKey={activeNestedTabKey} |
| 108 |
hidden={12 !== activeNestedTabKey} |
| 109 |
> |
| 110 |
<TabContentBody>Operators panel</TabContentBody> |
| 111 |
</TabContent> |
| 112 |
<TabContent |
| 113 |
key={13} |
| 114 |
eventKey={13} |
| 115 |
id={`tabContent${13}`} |
| 116 |
activeKey={activeNestedTabKey} |
| 117 |
hidden={13 !== activeNestedTabKey} |
| 118 |
> |
| 119 |
<TabContentBody>Virtualization panel</TabContentBody> |
| 120 |
</TabContent> |
| 121 |
</GridItem> |
| 122 |
</Grid> |
| 123 |
); |
| 124 |
|
| 125 |
return ( |
| 126 |
<DashboardWrapper hasPageTemplateTitle> |
| 127 |
<PageSection type="tabs" isWidthLimited aria-label="Primary navigation tabs"> |
| 128 |
<Tabs |
| 129 |
activeKey={activeTabKey} |
| 130 |
onSelect={(_event, tabIndex) => handleTabClick(Number(tabIndex))} |
| 131 |
usePageInsets |
| 132 |
id="nested-tabs-example-tabs-list" |
| 133 |
> |
| 134 |
<Tab eventKey={0} title={<TabTitleText>What's new</TabTitleText>} tabContentId={`tabContent${0}`} /> |
| 135 |
<Tab eventKey={1} title={<TabTitleText>Get started</TabTitleText>} tabContentId={`tabContent${1}`} /> |
| 136 |
<Tab eventKey={2} title={<TabTitleText>Knowledge</TabTitleText>} tabContentId={`tabContent${2}`} /> |
| 137 |
<Tab eventKey={3} title={<TabTitleText>Support</TabTitleText>} tabContentId={`tabContent${3}`} /> |
| 138 |
</Tabs> |
| 139 |
</PageSection> |
| 140 |
<PageSection isWidthLimited aria-label="Primary tab content"> |
| 141 |
<TabContent key={0} eventKey={0} id={`tabContent${0}`} activeKey={activeTabKey} hidden={0 !== activeTabKey}> |
| 142 |
<TabContentBody>What's new panel</TabContentBody> |
| 143 |
</TabContent> |
| 144 |
<TabContent key={1} eventKey={1} id={`tabContent${1}`} activeKey={activeTabKey} hidden={1 !== activeTabKey}> |
| 145 |
<TabContentBody>{tabContent}</TabContentBody> |
| 146 |
</TabContent> |
| 147 |
<TabContent key={2} eventKey={2} id={`tabContent${2}`} activeKey={activeTabKey} hidden={2 !== activeTabKey}> |
| 148 |
<TabContentBody>Knowledge panel</TabContentBody> |
| 149 |
</TabContent> |
| 150 |
<TabContent key={3} eventKey={3} id={`tabContent${3}`} activeKey={activeTabKey} hidden={3 !== activeTabKey}> |
| 151 |
<TabContentBody>Support Panel</TabContentBody> |
| 152 |
</TabContent> |
| 153 |
</PageSection> |
| 154 |
</DashboardWrapper> |
| 155 |
); |
| 156 |
}; |