Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
fix(tab-bar): enforce that children are instances of the Tab component
Browse files Browse the repository at this point in the history
BREAKING CHANGE: TabBar will now only accept Tab instances
  • Loading branch information
HendrikThePendric committed Nov 5, 2019
1 parent 6559098 commit 61099e2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Tabs/TabBar.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React from 'react'
import propTypes from '@dhis2/prop-types'
import { colors } from '../theme'
import cx from 'classnames'

import { colors } from '../theme.js'
import { Tab } from './Tab.js'

/**
* @module
* @param {TabBar.PropTypes} props
Expand Down Expand Up @@ -35,12 +37,15 @@ const TabBar = ({ fixed, children, className }) => (
/**
* @typedef {Object} PropTypes
* @static
* @prop {Node} children
* @prop {Tab|Array.<Tab>} children
* @prop {string} [className]
* @prop {boolean} [fixed]
*/
TabBar.propTypes = {
children: propTypes.node.isRequired,
children: propTypes.oneOfType([
propTypes.instanceOfComponent(Tab),
propTypes.arrayOf(propTypes.instanceOfComponent(Tab)),
]),
className: propTypes.string,
fixed: propTypes.bool,
}
Expand Down

0 comments on commit 61099e2

Please sign in to comment.