Sha256: 194fd039dbd13f7459fdbfbf393b72a530abdaaa3c7537ce9a5dac80f20ad7ea

Contents?: true

Size: 659 Bytes

Versions: 2

Compression:

Stored size: 659 Bytes

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { Chip, ChipGroup } from '@patternfly/react-core';

export const SelectedChips = ({ selected, setSelected }) => {
  const deleteItem = itemToRemove => {
    setSelected(oldSelected =>
      oldSelected.filter(item => item !== itemToRemove)
    );
  };
  return (
    <ChipGroup className="hosts-chip-group">
      {selected.map(chip => (
        <Chip key={chip} id={chip} onClick={() => deleteItem(chip)}>
          {chip}
        </Chip>
      ))}
    </ChipGroup>
  );
};

SelectedChips.propTypes = {
  selected: PropTypes.array.isRequired,
  setSelected: PropTypes.func.isRequired,
};

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foreman_remote_execution-4.8.0 webpack/JobWizard/steps/HostsAndInputs/SelectedChips.js
foreman_remote_execution-4.5.6 webpack/JobWizard/steps/HostsAndInputs/SelectedChips.js