diff --git a/app/src/examples/example3/Example3.tsx b/app/src/examples/example3/Example3.tsx index 425b7bfc..48b90b27 100644 --- a/app/src/examples/example3/Example3.tsx +++ b/app/src/examples/example3/Example3.tsx @@ -1,8 +1,8 @@ -import { PageSection, PageSectionVariants, Text, TextContent } from '@patternfly/react-core' +import { CodeBlock, CodeBlockCode, PageSection, Text, TextContent } from '@patternfly/react-core' import React from 'react' export const Example3: React.FunctionComponent = () => ( - + Example 3 @@ -10,14 +10,17 @@ export const Example3: React.FunctionComponent = () => ( toolbar. - Components should be added in to the Plugin structure using the `headerItems` array. Toolbar components should - be created as single FunctionComponents and added to the array. + Components should be added in to the Plugin structure using the headerItems array. Toolbar + components should be created as single FunctionComponents and added to the array. Header components will remain in the toolbar until the focus is changed to an alternative plugin. However, - should you wish to persist the components despite the UI focus then an alternative structure can be added to the - `headerItems` array in the form {component: 'MyComponent', universal: true}. + should you wish to persist the components despite the UI focus then an alternative structure can be added to the{' '} + headerItems array in the form: + + {component: MyComponent, universal: true} + ) diff --git a/app/src/examples/example3/ToolbarItemComp.tsx b/app/src/examples/example3/Example3HeaderItems.tsx similarity index 82% rename from app/src/examples/example3/ToolbarItemComp.tsx rename to app/src/examples/example3/Example3HeaderItems.tsx index 6c7b7d78..d210e67e 100644 --- a/app/src/examples/example3/ToolbarItemComp.tsx +++ b/app/src/examples/example3/Example3HeaderItems.tsx @@ -1,7 +1,7 @@ import React from 'react' import { Button, Dropdown, DropdownItem, DropdownSeparator, DropdownToggle, Modal } from '@patternfly/react-core' -export const ToolbarItemComp1: React.FunctionComponent = () => { +export const Example3HeaderItem1: React.FunctionComponent = () => { const [isModalOpen, setIsModalOpen] = React.useState(false) const handleModalToggle = () => { @@ -10,11 +10,12 @@ export const ToolbarItemComp1: React.FunctionComponent = () => { return ( - { ) } -export const ToolbarItemComp2: React.FunctionComponent = () => { +export const Example3HeaderItem2: React.FunctionComponent = () => { const [isOpen, setIsOpen] = React.useState(false) const onToggle = (isOpen: boolean) => { @@ -78,14 +79,16 @@ export const ToolbarItemComp2: React.FunctionComponent = () => { return ( - Plugin Example 3 Dropdown + + Example 3 Dropdown } isOpen={isOpen} dropdownItems={dropdownItems} + isPlain /> ) } diff --git a/app/src/examples/example3/index.ts b/app/src/examples/example3/index.ts index 8938955e..68d0d643 100644 --- a/app/src/examples/example3/index.ts +++ b/app/src/examples/example3/index.ts @@ -1,6 +1,6 @@ import { hawtio, HawtioPlugin } from '@hawtio/react' import { Example3 } from './Example3' -import { ToolbarItemComp1, ToolbarItemComp2 } from './ToolbarItemComp' +import { Example3HeaderItem1, Example3HeaderItem2 } from './Example3HeaderItems' export const registerExample3: HawtioPlugin = () => { hawtio.addPlugin({ @@ -8,7 +8,13 @@ export const registerExample3: HawtioPlugin = () => { title: 'Example 3', path: '/example3', component: Example3, - headerItems: [ToolbarItemComp1, { component: ToolbarItemComp2, universal: true }], + headerItems: [ + // Header item local to the plugin + Example3HeaderItem1, + // Header item universal to the console + // You can also make it local by setting universal=false + { component: Example3HeaderItem2, universal: true }, + ], isActive: async () => true, }) }