Sha256: 502a7da1f439a2f28a3f3eaa586e852b5d8690e7178bbfe46871078fce65c3f1

Contents?: true

Size: 1.51 KB

Versions: 9

Compression:

Stored size: 1.51 KB

Contents

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

import Badge from '../../pb_badge/_badge'
import FormPill from '../../pb_form_pill/_form_pill'
import { SelectValueType } from '../_typeahead'

type Props = {
  data: SelectValueType,
  removeProps: any,
  selectProps: any,
}

const MultiValue = (props: Props): React.ReactElement => {
  const { removeProps } = props
  const { imageUrl, label } = props.data
  const { multiKit } = props.selectProps

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

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

  return (
    <components.MultiValueContainer
        className="text_input_multivalue_container"
        {...props}
    >
      {multiKit === 'badge' &&
        <Badge
            closeProps={removeProps}
            removeIcon
            text={label}
            variant="primary"
        />
      }

      {multiKit !== 'badge' && imageUrl &&
        <FormPill
            avatarUrl={imageUrl}
            closeProps={removeProps}
            marginRight="xs"
            name={label}
            size={multiKit === 'smallPill' ? 'small' : ''}
            text=''
        />
      }

      {multiKit !== 'badge' && !imageUrl &&
        <FormPill
            closeProps={removeProps}
            marginRight="xs"
            name=''
            size={multiKit === 'smallPill' ? 'small' : ''}
            text={label}
        />
      }
    </components.MultiValueContainer>
  )
}

export default MultiValue

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
playbook_ui-13.33.0.pre.alpha.PLAY14143318 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-13.33.0.pre.alpha.PLAY14143312 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-13.33.0.pre.alpha.PBNTR405dropdownformfixesrails3311 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-13.33.0.pre.alpha.PLAY1454formpillicons3309 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-13.33.0.pre.alpha.PLAY14143306 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-13.33.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-13.32.0.pre.alpha.PBNTR405dropdownformfixesrails3301 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-13.32.0.pre.alpha.PLAY14143297 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-13.31.0.pre.alpha.PLAY10863204 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx