import React from 'react'; import PropTypes from 'prop-types'; import { Link } from '@gatsbyjs/reach-router'; import { gettext, siteRoot, canAddRepo, canViewOrg } from '../utils/constants'; const propTypes = { currentTab: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, tabItemClick: PropTypes.func.isRequired, }; class FilesSubNav extends React.Component { constructor(props) { super(props); this.state = { groupItems: [] }; } tabItemClick = (e, param, id) => { this.props.tabItemClick(e, param, id); }; getActiveClass = (tab) => { return this.props.currentTab === tab ? 'active' : ''; }; renderSharedGroups() { return ( <> {this.props.groupItems.map(item => { return (
  • this.tabItemClick(e, item.name, item.id)} > {item.name}
  • ); })} ); } render() { return ( <> {canAddRepo && (
  • this.tabItemClick(e, 'my-libs')}> {gettext('My Libraries')}
  • )}
  • this.tabItemClick(e, 'shared-libs')}> {gettext('Shared with me')}
  • {canViewOrg &&
  • this.tabItemClick(e, 'org')}> {gettext('Shared with all')}
  • } {this.renderSharedGroups()} ); } } FilesSubNav.propTypes = propTypes; export default FilesSubNav;