Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(v2): fix build caused when one tab item #1938

Merged
merged 3 commits into from
Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]}
{
lex111 marked this conversation as resolved.
Show resolved Hide resolved
Children.toArray(children).filter(
child => child.props.value === selectedValue,
)[0]
}
</div>
</div>
);
Expand Down