Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Bushell committed Jul 16, 2018
1 parent 19b7151 commit 5a7a6ec
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions lib/components/src/tabs/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,20 +143,23 @@ export const panelProps = {

export const Tabs = ({ children, selected, onSelect, absolute, bordered }) => {
const list = React.Children.toArray(children).map(
({ props: { title, id, children: content } }, index) => ({
active: selected ? id === selected : index === 0,
title,
id,
render:
typeof content === 'function' ? content
: Array.isArray(content) && typeof content[0] === 'function' ? content[0]
: // eslint-disable-next-line react/prop-types
({ active }) => (
<VisuallyHidden active={active} role="tabpanel">
{content}
</VisuallyHidden>
),
})
({ props: { title, id, children: childrenOfChild } }, index) => {
const content = Array.isArray(childrenOfChild) ? childrenOfChild[0] : childrenOfChild;
return {
active: selected ? id === selected : index === 0,
title,
id,
render:
typeof content === 'function'
? content
: // eslint-disable-next-line react/prop-types
({ active }) => (
<VisuallyHidden active={active} role="tabpanel">
{content}
</VisuallyHidden>
),
};
}
);

return list.length ? (
Expand Down

0 comments on commit 5a7a6ec

Please sign in to comment.