All files / components/tabs/header/tab index.js

0% Statements 0/15
0% Branches 0/8
0% Functions 0/2
0% Lines 0/6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26                                                   
import React from 'react'
import PropTypes from 'prop-types'
 
const Tab = ({ label, icon, active, onClick }) => (
  <li className={active ? 'active' : null}>
    <a onClick={onClick}>
      { icon && <img src={icon} alt={label} /> }
      { label }
    </a>
  </li>
)
 
Tab.propTypes = {
  label: PropTypes.string.isRequired,
  icon: PropTypes.string,
  active: PropTypes.bool,
  onClick: PropTypes.func
}
 
Tab.defaultProps = {
  active: 0,
  label: 'No label'
}
 
export default Tab