Sha256: 9c396355bb9f22fa1efb99f2d92d3af2f7ef3e03b32a12371eceadb482d20e08

Contents?: true

Size: 999 Bytes

Versions: 9

Compression:

Stored size: 999 Bytes

Contents

import React from 'react';
import PropTypes from 'prop-types';

// eslint-disable-next-line no-unused-vars
function AssociationPickerItem(props) {
  let input;

  if (props.item._create) {
    input = <input type="hidden" name={`${props.createName}[]`} value={props.item.name} />;
  } else if (props.allowMultiple) {
    input = <input type="hidden" name={`${props.name}[]`} value={props.item.id} />;
  } else {
    input = <input type="hidden" name={props.name} value={props.item.id} />;
  }

  return (
    <div className="o-assocpicker-selection">
      {input}
      <div className="o-assocpicker-title">
        {props.item.name}
        <span className="o-assocpicker-close" onClick={props.onClickClose}>
          ×
        </span>
      </div>
    </div>
  );
}

AssociationPickerItem.propTypes = {
  item: PropTypes.object,
  createName: PropTypes.string,
  allowMultiple: PropTypes.bool,
  name: PropTypes.string,
  onClickClose: PropTypes.func,
};

export default AssociationPickerItem;

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
lcms-engine-0.5.5 app/javascript/components/admin/association-picker/AssociationPickerItem.jsx
lcms-engine-0.5.4 app/javascript/components/admin/association-picker/AssociationPickerItem.jsx
lcms-engine-0.5.3 app/javascript/components/admin/association-picker/AssociationPickerItem.jsx
lcms-engine-0.5.2 app/javascript/components/admin/association-picker/AssociationPickerItem.jsx
lcms-engine-0.5.1 app/javascript/components/admin/association-picker/AssociationPickerItem.jsx
lcms-engine-0.5.0 app/javascript/components/admin/association-picker/AssociationPickerItem.jsx
lcms-engine-0.4.2 app/javascript/components/admin/association-picker/AssociationPickerItem.jsx
lcms-engine-0.4.1 app/javascript/components/admin/association-picker/AssociationPickerItem.jsx
lcms-engine-0.4.0 app/javascript/components/admin/association-picker/AssociationPickerItem.jsx