Skip to content

Commit

Permalink
fix(codetabs): fix key warning
Browse files Browse the repository at this point in the history
- closes facebook#1255
  • Loading branch information
alexkrolick committed Mar 17, 2019
1 parent 93e2b7d commit ee3e5f8
Showing 1 changed file with 27 additions and 18 deletions.
45 changes: 27 additions & 18 deletions v1/lib/core/CodeTabsMarkdownBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,35 @@ class MarkdownBlock extends React.Component {
return (
<div className="tabs">
<div className="nav-tabs">
{tabs.map((t, i) => (
<div
className={`nav-link${i === 0 ? ' active' : ''}`}
id={`${t.id}-tab`}
data-group={`group_${t.groupId}`}
data-tab={`tabpanel_${t.id}`}>
{t.label}
</div>
))}
{tabs.map((t, i) => {
const tabId = `tab-group-${groupId}-tab-${t.id}`;
const contentId = `tab-group-${groupId}-content-${t.id}`;
return (
<div
id={tabId}
key={tabId}
className={`nav-link${i === 0 ? ' active' : ''}`}
data-group={`group_${t.groupId}`}
data-tab={contentId}>
{t.label}
</div>
);
})}
</div>
<div className="tab-content">
{tabs.map((t, i) => (
<div
className={`tab-pane${i === 0 ? ' active' : ''}`}
data-group={`group_${t.groupId}`}
tabIndex="-1"
id={`tabpanel_${t.id}`}>
{t.panelContent}
</div>
))}
{tabs.map((t, i) => {
const id = `tab-group-${groupId}-content-${t.id}`;
return (
<div
id={id}
key={id}
className={`tab-pane${i === 0 ? ' active' : ''}`}
data-group={`group_${t.groupId}`}
tabIndex="-1">
{t.panelContent}
</div>
);
})}
</div>
</div>
);
Expand Down

0 comments on commit ee3e5f8

Please sign in to comment.