Sha256: 50267afe0b58cf5d9eb1ecd71509683d6eaeaf362095f5f366a7e96fd7b2d577

Contents?: true

Size: 1.4 KB

Versions: 80

Compression:

Stored size: 1.4 KB

Contents

import React, { useState } from 'react';
import {
  AccordionItem,
  AccordionToggle,
  AccordionContent,
  Label,
} from '@patternfly/react-core';
import { UserIcon } from '@patternfly/react-icons';
import PropTypes from 'prop-types';
import ListItemStatus from '../ListItemStatus';
import Dashboard from '../../../Dashboard';

const ListItem = ({ label, account }) => {
  const [isExpanded, setIsExpanded] = useState(false);
  return (
    <AccordionItem>
      <AccordionToggle
        onClick={() => setIsExpanded(currentValue => !currentValue)}
        isExpanded={isExpanded}
      >
        <span>
          <Label
            className="account-icon"
            variant="outline"
            color="blue"
            icon={<UserIcon />}
          />
          {label}
        </span>
        <ListItemStatus key={`${label}_status`} account={account} />
      </AccordionToggle>
      <AccordionContent isHidden={!isExpanded}>
        <Dashboard accountID={account.id} account={account} />
      </AccordionContent>
    </AccordionItem>
  );
};

ListItem.propTypes = {
  label: PropTypes.string.isRequired,
  account: PropTypes.shape({
    generate_report_status: PropTypes.string,
    upload_report_status: PropTypes.string,
    id: PropTypes.number,
  }),
};

ListItem.defaultProps = {
  account: {
    generate_report_status: 'unknown',
    upload_report_status: 'unknown',
    id: 0,
  },
};

export default ListItem;

Version data entries

80 entries across 80 versions & 1 rubygems

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