()
| 10 | |
| 11 | export default class Tabs extends React.PureComponent<TabsProps> { |
| 12 | render() { |
| 13 | const {tabs = [], borderColor, onChange, onClose, fullScreen} = this.props; |
| 14 | |
| 15 | const hide = !isMac && tabs.length === 1; |
| 16 | |
| 17 | return ( |
| 18 | <nav className={`tabs_nav ${hide ? 'tabs_hiddenNav' : ''}`}> |
| 19 | {this.props.customChildrenBefore} |
| 20 | {tabs.length === 1 && isMac ? <div className="tabs_title">{tabs[0].title}</div> : null} |
| 21 | {tabs.length > 1 |
| 22 | ? [ |
| 23 | <ul key="list" className={`tabs_list ${fullScreen && isMac ? 'tabs_fullScreen' : ''}`}> |
| 24 | {tabs.map((tab, i) => { |
| 25 | const {uid, title, isActive, hasActivity} = tab; |
| 26 | const props = getTabProps(tab, this.props, { |
| 27 | text: title === '' ? 'Shell' : title, |
| 28 | isFirst: i === 0, |
| 29 | isLast: tabs.length - 1 === i, |
| 30 | borderColor, |
| 31 | isActive, |
| 32 | hasActivity, |
| 33 | onSelect: onChange.bind(null, uid), |
| 34 | onClose: onClose.bind(null, uid) |
| 35 | }); |
| 36 | return <Tab key={`tab-${uid}`} {...props} />; |
| 37 | })} |
| 38 | </ul>, |
| 39 | isMac && ( |
| 40 | <div |
| 41 | key="shim" |
| 42 | style={{borderColor}} |
| 43 | className={`tabs_borderShim ${fullScreen ? 'tabs_borderShimUndo' : ''}`} |
| 44 | /> |
| 45 | ) |
| 46 | ] |
| 47 | : null} |
| 48 | {this.props.customChildren} |
| 49 | |
| 50 | <style jsx>{` |
| 51 | .tabs_nav { |
| 52 | font-size: 12px; |
| 53 | height: 34px; |
| 54 | line-height: 34px; |
| 55 | vertical-align: middle; |
| 56 | color: #9b9b9b; |
| 57 | cursor: default; |
| 58 | position: relative; |
| 59 | -webkit-user-select: none; |
| 60 | -webkit-app-region: ${isMac ? 'drag' : ''}; |
| 61 | top: ${isMac ? '0px' : '34px'}; |
| 62 | } |
| 63 | |
| 64 | .tabs_hiddenNav { |
| 65 | display: none; |
| 66 | } |
| 67 | |
| 68 | .tabs_title { |
| 69 | text-align: center; |
nothing calls this directly
no test coverage detected