-
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.
feat(ChatbotConversationHistoryNav): Add isActive prop
Allow users to show an active conversation state via the isActive prop.
- Loading branch information
1 parent
9ea0adf
commit 32d931c
Showing
4 changed files
with
94 additions
and
1 deletion.
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
...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,76 @@ | ||
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> | ||
]; | ||
|
||
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, | ||
isActive: true | ||
}, | ||
{ 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 } | ||
] | ||
}; | ||
|
||
export const ChatbotHeaderDrawerWithSelection: React.FunctionComponent = () => { | ||
const [isDrawerOpen, setIsDrawerOpen] = React.useState(true); | ||
const displayMode = ChatbotDisplayMode.embedded; | ||
|
||
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>} | ||
/> | ||
</> | ||
); | ||
}; |
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