Skip to content

Commit f7e2cc3

Browse files
chore(docs): Use unique keys in examples (#693)
1 parent f4cfc9a commit f7e2cc3

File tree

5 files changed

+33
-33
lines changed

5 files changed

+33
-33
lines changed

packages/module/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithActions.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import ChatbotConversationHistoryNav, {
55
} from '@patternfly/chatbot/dist/dynamic/ChatbotConversationHistoryNav';
66
import { Checkbox, DropdownItem, DropdownList } from '@patternfly/react-core';
77

8-
const menuItems = [
9-
<DropdownList key="list-1">
8+
const generateMenuItems = (id: string) => [
9+
<DropdownList key={`header-drawer-with-actions-example-conversation-${id}-dropdown`}>
1010
<DropdownItem value="Download" id="Download">
1111
Download
1212
</DropdownItem>
@@ -23,29 +23,29 @@ const menuItems = [
2323
];
2424

2525
const conversations: { [key: string]: Conversation[] } = {
26-
Today: [{ id: '1', text: 'Red Hat products and services', menuItems }],
26+
Today: [{ id: '1', text: 'Red Hat products and services', menuItems: generateMenuItems('1') }],
2727
'This month': [
2828
{
2929
id: '2',
3030
text: 'Enterprise Linux installation and setup',
31-
menuItems
31+
menuItems: generateMenuItems('2')
3232
},
33-
{ id: '3', text: 'Troubleshoot system crash', menuItems }
33+
{ id: '3', text: 'Troubleshoot system crash', menuItems: generateMenuItems('3') }
3434
],
3535
March: [
36-
{ id: '4', text: 'Ansible security and updates', menuItems },
37-
{ id: '5', text: 'Red Hat certification', menuItems },
38-
{ id: '6', text: 'Lightspeed user documentation', menuItems }
36+
{ id: '4', text: 'Ansible security and updates', menuItems: generateMenuItems('4') },
37+
{ id: '5', text: 'Red Hat certification', menuItems: generateMenuItems('5') },
38+
{ id: '6', text: 'Lightspeed user documentation', menuItems: generateMenuItems('6') }
3939
],
4040
February: [
41-
{ id: '7', text: 'Crashing pod assistance', menuItems },
42-
{ id: '8', text: 'OpenShift AI pipelines', menuItems },
43-
{ id: '9', text: 'Updating subscription plan', menuItems },
44-
{ id: '10', text: 'Red Hat licensing options', menuItems }
41+
{ id: '7', text: 'Crashing pod assistance', menuItems: generateMenuItems('7') },
42+
{ id: '8', text: 'OpenShift AI pipelines', menuItems: generateMenuItems('8') },
43+
{ id: '9', text: 'Updating subscription plan', menuItems: generateMenuItems('9') },
44+
{ id: '10', text: 'Red Hat licensing options', menuItems: generateMenuItems('10') }
4545
],
4646
January: [
47-
{ id: '11', text: 'RHEL system performance', menuItems },
48-
{ id: '12', text: 'Manage user accounts', menuItems }
47+
{ id: '11', text: 'RHEL system performance', menuItems: generateMenuItems('11') },
48+
{ id: '12', text: 'Manage user accounts', menuItems: generateMenuItems('12') }
4949
]
5050
};
5151

packages/module/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSelection.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import ChatbotConversationHistoryNav, {
55
} from '@patternfly/chatbot/dist/dynamic/ChatbotConversationHistoryNav';
66
import { Checkbox, DropdownItem, DropdownList } from '@patternfly/react-core';
77

8-
const menuItems = [
9-
<DropdownList key="list-1">
8+
const generateMenuItems = (id: string) => [
9+
<DropdownList key={`header-drawer-with-selections-example-conversation-${id}-dropdown`}>
1010
<DropdownItem value="Download" id="Download">
1111
Download
1212
</DropdownItem>
@@ -29,29 +29,29 @@ export const ChatbotHeaderDrawerWithSelection: FunctionComponent = () => {
2929
const displayMode = ChatbotDisplayMode.embedded;
3030

3131
const conversations: { [key: string]: Conversation[] } = {
32-
Today: [{ id: '1', text: 'Red Hat products and services', menuItems }],
32+
Today: [{ id: '1', text: 'Red Hat products and services', menuItems: generateMenuItems('1') }],
3333
'This month': [
3434
{
3535
id: '2',
3636
text: 'Enterprise Linux installation and setup',
37-
menuItems
37+
menuItems: generateMenuItems('2')
3838
},
39-
{ id: '3', text: 'Troubleshoot system crash', menuItems }
39+
{ id: '3', text: 'Troubleshoot system crash', menuItems: generateMenuItems('3') }
4040
],
4141
March: [
42-
{ id: '4', text: 'Ansible security and updates', menuItems },
43-
{ id: '5', text: 'Red Hat certification', menuItems },
44-
{ id: '6', text: 'Lightspeed user documentation', menuItems }
42+
{ id: '4', text: 'Ansible security and updates', menuItems: generateMenuItems('4') },
43+
{ id: '5', text: 'Red Hat certification', menuItems: generateMenuItems('5') },
44+
{ id: '6', text: 'Lightspeed user documentation', menuItems: generateMenuItems('6') }
4545
],
4646
February: [
47-
{ id: '7', text: 'Crashing pod assistance', menuItems },
48-
{ id: '8', text: 'OpenShift AI pipelines', menuItems },
49-
{ id: '9', text: 'Updating subscription plan', menuItems },
50-
{ id: '10', text: 'Red Hat licensing options', menuItems }
47+
{ id: '7', text: 'Crashing pod assistance', menuItems: generateMenuItems('7') },
48+
{ id: '8', text: 'OpenShift AI pipelines', menuItems: generateMenuItems('8') },
49+
{ id: '9', text: 'Updating subscription plan', menuItems: generateMenuItems('9') },
50+
{ id: '10', text: 'Red Hat licensing options', menuItems: generateMenuItems('10') }
5151
],
5252
January: [
53-
{ id: '11', text: 'RHEL system performance', menuItems },
54-
{ id: '12', text: 'Manage user accounts', menuItems }
53+
{ id: '11', text: 'RHEL system performance', menuItems: generateMenuItems('11') },
54+
{ id: '12', text: 'Manage user accounts', menuItems: generateMenuItems('12') }
5555
]
5656
};
5757

packages/module/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarAttach.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const ChatbotMessageBarDefaultAttachExample: FunctionComponent = () => {
6666
};
6767

6868
const initialMenuItems = [
69-
<DropdownList key="list-1">
69+
<DropdownList key="message-bar-attach-menu-items">
7070
<DropdownItem className="pf-chatbot-source-details-dropdown-item" value="auth-operator Pod" id="0">
7171
<SourceDetailsMenuItem
7272
icon={
@@ -93,7 +93,7 @@ export const ChatbotMessageBarDefaultAttachExample: FunctionComponent = () => {
9393
/>
9494
</DropdownItem>
9595
</DropdownList>,
96-
<DropdownGroup key="group2">
96+
<DropdownGroup key="message-bar-attach-dropdown-group">
9797
<DropdownList>
9898
<DropdownItem value="Alerts" id="1" icon={<BellIcon />}>
9999
Alerts

packages/module/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import '@patternfly/chatbot/dist/css/main.css';
2020
import { cloneElement, FunctionComponent, isValidElement, ReactNode, useState, Children } from 'react';
2121

2222
const initialMenuItems = [
23-
<DropdownList key="list-1">
23+
<DropdownList key="attachment-menu-example-initial-menu-items">
2424
<DropdownItem value="auth-operator Pod" id="0" className="pf-chatbot-source-details-dropdown-item">
2525
<SourceDetailsMenuItem
2626
icon={
@@ -47,7 +47,7 @@ const initialMenuItems = [
4747
/>
4848
</DropdownItem>
4949
</DropdownList>,
50-
<DropdownGroup key="group2">
50+
<DropdownGroup key="attachment-menu-example-initial-group">
5151
<DropdownList>
5252
<DropdownItem value="Alerts" id="1" icon={<BellIcon />}>
5353
Alerts

packages/module/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotTranscripts.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export const ChatbotDemo: FunctionComponent = () => {
230230
id: '1',
231231
text: 'Hello, can you give me an example of what you can do?',
232232
menuItems: (
233-
<DropdownList key={`list-1`}>
233+
<DropdownList key="transcript-example-initial-menu-items">
234234
<DropdownItem
235235
value="Download"
236236
id={`Download-1`}

0 commit comments

Comments
 (0)