-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #374 from rebeccaalpert/menuitem
fix(ChatbotConversationHistoryNav): Add additional menu item props
- Loading branch information
Showing
4 changed files
with
106 additions
and
2 deletions.
There are no files selected for viewing
78 changes: 78 additions & 0 deletions
78
...tternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSelection.tsx
This file contains 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,78 @@ | ||
import React from 'react'; | ||
import { ChatbotDisplayMode } from '@patternfly/chatbot/dist/dynamic/Chatbot'; | ||
import ChatbotConversationHistoryNav, { | ||
Conversation | ||
} from '@patternfly/chatbot/dist/dynamic/ChatbotConversationHistoryNav'; | ||
import { Checkbox, DropdownItem, DropdownList } from '@patternfly/react-core'; | ||
|
||
const menuItems = [ | ||
<DropdownList key="list-1"> | ||
<DropdownItem value="Share" id="Share"> | ||
Share | ||
</DropdownItem> | ||
<DropdownItem value="Rename" id="Rename"> | ||
Rename | ||
</DropdownItem> | ||
<DropdownItem value="Archive" id="Archive"> | ||
Archive | ||
</DropdownItem> | ||
<DropdownItem value="Delete" id="Delete"> | ||
Delete | ||
</DropdownItem> | ||
</DropdownList> | ||
]; | ||
|
||
export const ChatbotHeaderDrawerWithSelection: React.FunctionComponent = () => { | ||
const [isDrawerOpen, setIsDrawerOpen] = React.useState(true); | ||
const [currentSelection, setCurrentSelection] = React.useState('2'); | ||
const displayMode = ChatbotDisplayMode.embedded; | ||
|
||
const conversations: { [key: string]: Conversation[] } = { | ||
Today: [{ id: '1', text: 'Red Hat products and services', menuItems }], | ||
'This month': [ | ||
{ | ||
id: '2', | ||
text: 'Enterprise Linux installation and setup', | ||
menuItems | ||
}, | ||
{ id: '3', text: 'Troubleshoot system crash', menuItems } | ||
], | ||
March: [ | ||
{ id: '4', text: 'Ansible security and updates', menuItems }, | ||
{ id: '5', text: 'Red Hat certification', menuItems }, | ||
{ id: '6', text: 'Lightspeed user documentation', menuItems } | ||
], | ||
February: [ | ||
{ id: '7', text: 'Crashing pod assistance', menuItems }, | ||
{ id: '8', text: 'OpenShift AI pipelines', menuItems }, | ||
{ id: '9', text: 'Updating subscription plan', menuItems }, | ||
{ id: '10', text: 'Red Hat licensing options', menuItems } | ||
], | ||
January: [ | ||
{ id: '11', text: 'RHEL system performance', menuItems }, | ||
{ id: '12', text: 'Manage user accounts', menuItems } | ||
] | ||
}; | ||
|
||
return ( | ||
<> | ||
<Checkbox | ||
label="Display drawer" | ||
isChecked={isDrawerOpen} | ||
onChange={() => setIsDrawerOpen(!isDrawerOpen)} | ||
id="drawer-actions-visible" | ||
name="drawer-actions-visible" | ||
></Checkbox> | ||
<ChatbotConversationHistoryNav | ||
displayMode={displayMode} | ||
onDrawerToggle={() => setIsDrawerOpen(!isDrawerOpen)} | ||
isDrawerOpen={isDrawerOpen} | ||
setIsDrawerOpen={setIsDrawerOpen} | ||
conversations={conversations} | ||
drawerContent={<div>Drawer content</div>} | ||
activeItemId={currentSelection} | ||
onSelectActiveItem={(_e, id) => setCurrentSelection(id as string)} | ||
/> | ||
</> | ||
); | ||
}; |
This file contains 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
This file contains 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
This file contains 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