Sha256: 934584683da823a51fbd89e7645f3e0ee4b38595dc7c1e3be8979e7d11732890

Contents?: true

Size: 1.25 KB

Versions: 7

Compression:

Stored size: 1.25 KB

Contents

/* @flow */

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

import { Badge, 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 { badges } = props.selectProps

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

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

  return (
    <components.MultiValueContainer
        className="text_input_multivalue_container"
        {...props}
    >
      <If condition={badges}>
        <Badge
            closeProps={removeProps}
            removeIcon
            text={label}
            variant="primary"
        />
        <Else />
        <If condition={imageUrl}>
          <FormPill
              avatarUrl={imageUrl}
              closeProps={removeProps}
              marginRight="xs"
              name={label}
          />
          <Else />
          <FormPill
              closeProps={removeProps}
              marginRight="xs"
              text={label}
          />
        </If>
      </If>
    </components.MultiValueContainer>
  )
}

export default MultiValue

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
playbook_ui-9.3.0.alpha.inline3 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-9.3.0.alpha.inline2 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-9.3.0.alpha.inline1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-8.2.1.pre.alpha5 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-8.2.1.pre.alpha4 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-8.2.1.pre.alpha3 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-8.2.1.pre.alpha2 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx