Sha256: 7d8e8dd56e892636f97e02dbf32b905073041f55352e3353cc3913e90ba936fa

Contents?: true

Size: 1 KB

Versions: 17

Compression:

Stored size: 1 KB

Contents

/* @flow */

import React from 'react'
import { components } from 'react-select'

import { FormPill } from '../../'

type Props = {
  data: object,
  multiValueTemplate: any,
  removeProps: any,
  selectProps: any,
}

const MultiValue = (props: Props) => {
  const {
    data,
    removeProps,
    selectProps,
  } = props

  const handleOnClick = () => {
    if (selectProps.onMultiValueClick) selectProps.onMultiValueClick(data)
    removeProps.onClick()
  }
  const { imageUrl, label } = data

  return (
    <components.MultiValueContainer
        className="text_input_multivalue_container"
        {...props}
    >
      <If condition={imageUrl}>
        <FormPill
            avatarUrl={imageUrl}
            marginRight="xs"
            name={label}
            onClick={handleOnClick}
        />
        <Else />
        <FormPill
            marginRight="xs"
            onClick={handleOnClick}
            text={label}
        />
      </If>
    </components.MultiValueContainer>
  )
}

export default MultiValue

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
playbook_ui-7.3.0.pre.alpha2 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.0.1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-6.8.2.pre.alpha1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.0.0.pre.alpha15 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.0.1.pre.alpha14 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.0.0.pre.alpha14 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.0.0.pre.alpha13 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.0.0.pre.alpha12 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.0.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.0.0.pre.alpha11 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-6.8.1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-6.8.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-6.7.0.pre.alpha1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-6.7.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-6.6.1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.0.0.pre.alpha10 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-6.6.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx