Skip to content

Commit

Permalink
fix(codetabs): fix key warning (#1284)
Browse files Browse the repository at this point in the history
- closes #1255
  • Loading branch information
alexkrolick authored and yangshun committed Mar 18, 2019
1 parent 93e2b7d commit f15ba1b
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 f15ba1b

Please sign in to comment.