Sha256: b682d6801ec8df493cee7b6f83cb6fdc2a036a29dbb9b572874f9476e5c033d4

Contents?: true

Size: 1.38 KB

Versions: 14

Compression:

Stored size: 1.38 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 { multiKit } = 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={multiKit === 'badge'}>
        <Badge
            closeProps={removeProps}
            removeIcon
            text={label}
            variant="primary"
        />
        <Else />
        <If condition={imageUrl}>
          <FormPill
              avatarUrl={imageUrl}
              closeProps={removeProps}
              marginRight="xs"
              name={label}
              size={multiKit === 'smallPill' ? 'small' : ''}
          />
          <Else />
          <FormPill
              closeProps={removeProps}
              marginRight="xs"
              size={multiKit === 'smallPill' ? 'small' : ''}
              text={label}
          />
        </If>
      </If>
    </components.MultiValueContainer>
  )
}

export default MultiValue

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
playbook_ui-9.19.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-9.19.0.pre.alphafonts app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-9.18.0.flow.bin.alpha app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-9.18.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-9.17.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-9.17.0.pre.decouple.website2 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-9.16.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-9.15.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-9.15.0.pre.decouple.website1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-9.14.1.alpha.radio.alignment app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-9.14.1.alpha.highcharts9 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-9.14.1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-9.13.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-9.9.0.alpha.inline1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx