Skip to content

Commit

Permalink
fix(v2): fix build caused when one tab item (#1938)
Browse files Browse the repository at this point in the history
* fix(v2): fix build caused when one tab item

* Use React method
  • Loading branch information
lex111 authored and yangshun committed Nov 5, 2019
1 parent 3e58062 commit 3b9309f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- **HOTFIX for 2.0.0-alpha.32** - Fix build compilation if exists only one code tab.
- Add table of contents highlighting on scroll.

## 2.0.0-alpha.32
Expand Down
8 changes: 6 additions & 2 deletions packages/docusaurus-theme-classic/src/theme/Tabs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import React, {useState} from 'react';
import React, {useState, Children} from 'react';

import classnames from 'classnames';

Expand All @@ -31,7 +31,11 @@ function Tabs(props) {
))}
</ul>
<div className="margin-vert--md">
{[...children].filter(child => child.props.value === selectedValue)[0]}
{
Children.toArray(children).filter(
child => child.props.value === selectedValue,
)[0]
}
</div>
</div>
);
Expand Down

0 comments on commit 3b9309f

Please sign in to comment.