Sha256: fe54e909803823279e509b6ae013f9595629a8d6be31b2dfa20b8dade381591b

Contents?: true

Size: 1.02 KB

Versions: 30

Compression:

Stored size: 1.02 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 { removeProps } = props
  const { imageUrl, label } = props.data

  const formPillProps = {
    marginRight: 'xs',
    name: label,
  }

  if (typeof imageUrl === 'string') formPillProps.avatarUrl = imageUrl

  const handleOnClick = removeProps.onClick

  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

30 entries across 30 versions & 1 rubygems

Version Path
playbook_ui-7.14.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.13.0.pre.alpha1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.13.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.12.1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.12.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.11.1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.11.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.11.0.pre.alpha1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.10.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.9.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.8.4 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.8.3 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.8.2 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.8.1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.8.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.7.0.pre.alpha1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.7.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.6.2.pre.alpha1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.6.2 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-7.6.1.pre.alpha1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx