-
Notifications
You must be signed in to change notification settings - Fork 376
chore(miscellaneous): update demo and example flags from js to ts #12198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
nicolethoen
merged 4 commits into
patternfly:main
from
Mash707:update-flags-for-demo-and-examples
Jan 8, 2026
+532
−516
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
185 changes: 185 additions & 0 deletions
185
packages/react-core/src/demos/examples/Tabs/TabsOpen.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,185 @@ | ||
| import { useState } from 'react'; | ||
| import { | ||
| PageSection, | ||
| PageBreadcrumb, | ||
| Breadcrumb, | ||
| BreadcrumbItem, | ||
| Tabs, | ||
| Tab, | ||
| TabContent, | ||
| TabContentBody, | ||
| TabTitleText, | ||
| Title, | ||
| DescriptionList, | ||
| DescriptionListGroup, | ||
| DescriptionListTerm, | ||
| DescriptionListDescription, | ||
| Label, | ||
| LabelGroup, | ||
| Flex, | ||
| FlexItem | ||
| } from '@patternfly/react-core'; | ||
| import CheckCircleIcon from '@patternfly/react-icons/dist/js/icons/check-circle-icon'; | ||
| import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon'; | ||
| import spacing from '@patternfly/react-styles/css/utilities/Spacing/spacing'; | ||
| import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper'; | ||
|
|
||
| export const TabsOpen: React.FunctionComponent = () => { | ||
| const [activeTabKey, setActiveTabKey] = useState(0); | ||
|
|
||
| // Toggle currently active tab | ||
| const handleTabClick = (_event: React.MouseEvent<HTMLElement>, tabIndex: number | string) => { | ||
| setActiveTabKey(tabIndex); | ||
| }; | ||
|
|
||
| const tabsBreadcrumb = ( | ||
| <PageBreadcrumb isWidthLimited> | ||
| <Breadcrumb> | ||
| <BreadcrumbItem to="#">Overview</BreadcrumbItem> | ||
| <BreadcrumbItem to="#">Pods</BreadcrumbItem> | ||
| <BreadcrumbItem to="#" isActive> | ||
| Pod details{' '} | ||
| </BreadcrumbItem> | ||
| </Breadcrumb> | ||
| </PageBreadcrumb> | ||
| ); | ||
|
|
||
| const tabContent = ( | ||
| <Flex direction={{ default: 'column' }}> | ||
| <FlexItem spacer={{ default: 'spacerLg' }}> | ||
| <Title headingLevel="h2" size="lg" className={spacing.mtSm} id="open-tabs-example-tabs-list-details-title"> | ||
| Pod details | ||
| </Title> | ||
| </FlexItem> | ||
| <FlexItem> | ||
| <DescriptionList columnModifier={{ lg: '2Col' }} aria-labelledby="open-tabs-example-tabs-list-details-title"> | ||
| <DescriptionListGroup> | ||
| <DescriptionListTerm>Name</DescriptionListTerm> | ||
| <DescriptionListDescription>3scale-control-fccb6ddb9-phyqv9</DescriptionListDescription> | ||
| </DescriptionListGroup> | ||
| <DescriptionListGroup> | ||
| <DescriptionListTerm>Status</DescriptionListTerm> | ||
| <DescriptionListDescription> | ||
| <Flex spacer={{ default: 'spacerLg' }}> | ||
| <FlexItem> | ||
| <CheckCircleIcon /> | ||
| </FlexItem> | ||
| <FlexItem>Running</FlexItem> | ||
| </Flex> | ||
| </DescriptionListDescription> | ||
| </DescriptionListGroup> | ||
| <DescriptionListGroup> | ||
| <DescriptionListTerm>Namespace</DescriptionListTerm> | ||
| <DescriptionListDescription> | ||
| <Flex spaceItems={{ default: 'spaceItemsSm' }}> | ||
| <FlexItem> | ||
| <Label color="teal">NS</Label> | ||
| </FlexItem> | ||
| <FlexItem> | ||
| <a href="#">knative-serving-ingress</a> | ||
| </FlexItem> | ||
| </Flex> | ||
| </DescriptionListDescription> | ||
| </DescriptionListGroup> | ||
| <DescriptionListGroup> | ||
| <DescriptionListTerm>Restart policy</DescriptionListTerm> | ||
| <DescriptionListDescription>Always restart</DescriptionListDescription> | ||
| </DescriptionListGroup> | ||
| <DescriptionListGroup> | ||
| <DescriptionListTerm>Labels</DescriptionListTerm> | ||
| <DescriptionListDescription> | ||
| <LabelGroup> | ||
| <Label>app=3scale-gateway</Label> | ||
| <Label>pod-template-has=6747686899</Label> | ||
| </LabelGroup> | ||
| </DescriptionListDescription> | ||
| </DescriptionListGroup> | ||
| <DescriptionListGroup> | ||
| <DescriptionListTerm>Active deadline seconds</DescriptionListTerm> | ||
| <DescriptionListDescription>Not configured</DescriptionListDescription> | ||
| </DescriptionListGroup> | ||
| <DescriptionListGroup> | ||
| <DescriptionListTerm>Tolerations</DescriptionListTerm> | ||
| <DescriptionListDescription>stuff</DescriptionListDescription> | ||
| </DescriptionListGroup> | ||
| <DescriptionListGroup> | ||
| <DescriptionListTerm>Pod IP</DescriptionListTerm> | ||
| <DescriptionListDescription>10.345.2.197</DescriptionListDescription> | ||
| </DescriptionListGroup> | ||
| <DescriptionListGroup> | ||
| <DescriptionListTerm>Annotations</DescriptionListTerm> | ||
| <DescriptionListDescription>stuff</DescriptionListDescription> | ||
| </DescriptionListGroup> | ||
| <DescriptionListGroup> | ||
| <DescriptionListTerm>Node</DescriptionListTerm> | ||
| <DescriptionListDescription> | ||
| <Flex spaceItems={{ default: 'spaceItemsSm' }}> | ||
| <FlexItem> | ||
| <Label color="purple">N</Label> | ||
| </FlexItem> | ||
| <FlexItem>ip-10-0-233-118.us-east-2.computer.external</FlexItem> | ||
| </Flex> | ||
| </DescriptionListDescription> | ||
| </DescriptionListGroup> | ||
| <DescriptionListGroup> | ||
| <DescriptionListTerm>Created at</DescriptionListTerm> | ||
| <DescriptionListDescription> | ||
| <time>Oct 15, 1:51 pm</time> | ||
| </DescriptionListDescription> | ||
| </DescriptionListGroup> | ||
| </DescriptionList> | ||
| </FlexItem> | ||
| </Flex> | ||
| ); | ||
|
|
||
| return ( | ||
| <DashboardWrapper hasNoBreadcrumb> | ||
| {tabsBreadcrumb} | ||
| <PageSection isWidthLimited aria-label="Pod header"> | ||
| <Flex | ||
| spaceItems={{ default: 'spaceItemsMd' }} | ||
| alignItems={{ default: 'alignItemsFlexStart' }} | ||
| flexWrap={{ default: 'noWrap' }} | ||
| > | ||
| <FlexItem> | ||
| <Label color="blue">N</Label> | ||
| </FlexItem> | ||
| <FlexItem> | ||
| <Title headingLevel="h1" size="2xl"> | ||
| 3scale-control-fccb6ddb9-phyqv9 | ||
| </Title> | ||
| </FlexItem> | ||
| <FlexItem flex={{ default: 'flexNone' }}> | ||
| <Label icon={<InfoCircleIcon />}>Running</Label> | ||
| </FlexItem> | ||
| </Flex> | ||
| </PageSection> | ||
| <PageSection type="tabs" isWidthLimited aria-label="Pod navigation tabs"> | ||
| <Tabs activeKey={activeTabKey} onSelect={handleTabClick} usePageInsets id="open-tabs-example-tabs-list"> | ||
| <Tab eventKey={0} title={<TabTitleText>Details</TabTitleText>} tabContentId={`tabContent${0}`} /> | ||
| <Tab eventKey={1} title={<TabTitleText>YAML</TabTitleText>} tabContentId={`tabContent${1}`} /> | ||
| <Tab eventKey={2} title={<TabTitleText>Environment</TabTitleText>} tabContentId={`tabContent${2}`} /> | ||
| <Tab eventKey={3} title={<TabTitleText>Events</TabTitleText>} tabContentId={`tabContent${3}`} /> | ||
| <Tab eventKey={4} title={<TabTitleText>Terminal</TabTitleText>} tabContentId={`tabContent${4}`} /> | ||
| </Tabs> | ||
| </PageSection> | ||
| <PageSection isWidthLimited aria-label="Pod content"> | ||
| <TabContent key={0} eventKey={0} id={`tabContent${0}`} activeKey={activeTabKey} hidden={0 !== activeTabKey}> | ||
| <TabContentBody>{tabContent}</TabContentBody> | ||
| </TabContent> | ||
| <TabContent key={1} eventKey={1} id={`tabContent${1}`} activeKey={activeTabKey} hidden={1 !== activeTabKey}> | ||
| <TabContentBody>YAML panel</TabContentBody> | ||
| </TabContent> | ||
| <TabContent key={2} eventKey={2} id={`tabContent${2}`} activeKey={activeTabKey} hidden={2 !== activeTabKey}> | ||
| <TabContentBody>Environment panel</TabContentBody> | ||
| </TabContent> | ||
| <TabContent key={3} eventKey={3} id={`tabContent${3}`} activeKey={activeTabKey} hidden={3 !== activeTabKey}> | ||
| <TabContentBody>Events panel</TabContentBody> | ||
| </TabContent> | ||
| <TabContent key={4} eventKey={4} id={`tabContent${4}`} activeKey={activeTabKey} hidden={4 !== activeTabKey}> | ||
| <TabContentBody>Terminal panel</TabContentBody> | ||
| </TabContent> | ||
| </PageSection> | ||
| </DashboardWrapper> | ||
| ); | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.