Sha256: 5ac349fadc51b193f843f0321c1471d9bf1a1795164dc2904ae8dc145134f61a

Contents?: true

Size: 1008 Bytes

Versions: 31

Compression:

Stored size: 1008 Bytes

Contents

import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { Tabs, Tab, TabTitleText } from '@patternfly/react-core';
import './TabbedView.scss';

const TabbedView = ({ tabs }) => {
  const [activeTabKey, setActiveTabKey] = useState(0);
  const handleTabClick = (_event, tabIndex) => setActiveTabKey(tabIndex);

  return (
    <Tabs activeKey={activeTabKey} onSelect={handleTabClick}>
      {tabs.map((tab, i) => {
        const { title, content } = tab;
        return (
          <Tab
            aria-label={`${title} tab`}
            key={`${title}`}
            eventKey={i}
            title={<TabTitleText>{title}</TabTitleText>}
          >
            <div className="tab-body-with-spacing">
              {content}
            </div>
          </Tab>
        );
      })}
    </Tabs>
  );
};

TabbedView.propTypes = {
  tabs: PropTypes.arrayOf(PropTypes.shape({
    title: PropTypes.string,
    content: PropTypes.element,
  })).isRequired,
};

export default TabbedView;

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
katello-4.0.3 webpack/components/TabbedView/TabbedView.js
katello-3.18.5 webpack/components/TabbedView/TabbedView.js
katello-4.0.2.1 webpack/components/TabbedView/TabbedView.js
katello-4.0.2 webpack/components/TabbedView/TabbedView.js
katello-3.18.4 webpack/components/TabbedView/TabbedView.js
katello-4.0.1.2 webpack/components/TabbedView/TabbedView.js
katello-3.18.3.1 webpack/components/TabbedView/TabbedView.js
katello-4.0.1.1 webpack/components/TabbedView/TabbedView.js
katello-3.18.3 webpack/components/TabbedView/TabbedView.js
katello-4.0.1 webpack/components/TabbedView/TabbedView.js
katello-4.0.0 webpack/components/TabbedView/TabbedView.js
katello-4.0.0.rc3.1 webpack/components/TabbedView/TabbedView.js
katello-4.0.0.rc3 webpack/components/TabbedView/TabbedView.js
katello-3.18.2.1 webpack/components/TabbedView/TabbedView.js
katello-3.18.2 webpack/components/TabbedView/TabbedView.js
katello-3.17.3 webpack/components/TabbedView/TabbedView.js
katello-4.0.0.rc2 webpack/components/TabbedView/TabbedView.js
katello-3.18.1.1 webpack/components/TabbedView/TabbedView.js
katello-3.17.2 webpack/components/TabbedView/TabbedView.js
katello-4.0.0.rc1 webpack/components/TabbedView/TabbedView.js