Sha256: c548861dc305eb6b7f2b404e92068e9b03f9ad3dd94afef04b8b4f3adcd55a17

Contents?: true

Size: 1.88 KB

Versions: 148

Compression:

Stored size: 1.88 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import {
  TabContainer,
  Nav,
  NavItem,
  TabContent,
  TabPane,
  Icon,
  noop,
} from 'patternfly-react';
import './navContainer.scss';
import FullScreenModal from '../FullScreenModal';

const NavContainer = ({
  items,
  showFullScreen,
  toggleFullScreen,
  terminalProps,
}) => {
  const navItems = items.map((item, index) => {
    const { name, icon, onClick } = item;
    return (
      <NavItem
        key={index}
        eventKey={index}
        onClick={onClick}
        className="nav_item"
      >
        <Icon name={icon} size="2x" />
        <p>{name}</p>
      </NavItem>
    );
  });
  const tabComponents = items.map(({ component: Component, props }, index) => (
    <TabPane key={index} eventKey={index}>
      <Component {...props} />
    </TabPane>
  ));
  return (
    <TabContainer id="basic-tabs-pf" defaultActiveKey={0}>
      <div className="dashboard">
        <Nav bsClass="nav nav-tabs nav-tabs-pf">{navItems}</Nav>
        <TabContent animation>{tabComponents}</TabContent>
        <FullScreenModal
          showFullScreen={showFullScreen}
          toggleFullScreen={toggleFullScreen}
          terminalProps={terminalProps}
        />
      </div>
    </TabContainer>
  );
};

NavContainer.propTypes = {
  items: PropTypes.arrayOf(
    PropTypes.shape({
      icon: PropTypes.string,
      name: PropTypes.string,
      component: PropTypes.func,
      onClick: PropTypes.func,
    })
  ),
  showFullScreen: PropTypes.bool,
  toggleFullScreen: PropTypes.func,
  terminalProps: PropTypes.shape({
    exitCode: PropTypes.string,
    logs: PropTypes.oneOfType([
      PropTypes.arrayOf(PropTypes.string),
      PropTypes.string,
    ]),
    error: PropTypes.string,
  }),
};

NavContainer.defaultProps = {
  items: [],
  showFullScreen: false,
  toggleFullScreen: noop,
  terminalProps: {},
};

export default NavContainer;

Version data entries

148 entries across 148 versions & 2 rubygems

Version Path
foreman_rh_cloud-11.0.3 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
foreman_rh_cloud-9.0.59 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
foreman_rh_cloud-11.0.2 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
foreman_rh_cloud-11.0.1 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
foreman_rh_cloud-11.0.0 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
foreman_rh_cloud-9.0.58 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
foreman_rh_cloud-10.0.2 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
foreman_rh_cloud-9.0.57 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
foreman_rh_cloud-10.0.1 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
foreman_rh_cloud-9.0.56 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
foreman_rh_cloud-9.0.55 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
foreman_rh_cloud-9.0.54 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
foreman_rh_cloud-9.0.53 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
foreman_rh_cloud-9.0.52 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
foreman_rh_cloud-8.0.52 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
foreman_rh_cloud-9.0.51 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
foreman_rh_cloud-8.0.51 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
foreman_rh_cloud-7.0.48 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
foreman_rh_cloud-7.0.47 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
foreman_rh_cloud-8.0.50 webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js