Sha256: 640495148a1de42e6749b768608112ec65f4baf3a5f5322b304de08d8207b817

Contents?: true

Size: 1.56 KB

Versions: 2

Compression:

Stored size: 1.56 KB

Contents

/* @flow */

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

import { FormPill, Badge } 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

  return (
    <components.MultiValueContainer
        className="text_input_multivalue_container"
        {...props}
    >
      {/* <If condition={imageUrl}>
        <FormPill
            avatarUrl={imageUrl}
            closeProps={removeProps}
            marginRight="xs"
            name={label}
        />
        <Else />
        <FormPill
            closeProps={removeProps}
            marginRight="xs"
            text={label}
        />
      </If> */}
      <If condition={props.selectProps.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

2 entries across 2 versions & 1 rubygems

Version Path
playbook_ui-8.2.1.pre.alpha1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-8.1.0.pre.alpha1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx