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