Sha256: 321038e93c46de7643acf81767e6c4d4ba988dfe1967f695a307b9d0f97829d0

Contents?: true

Size: 1018 Bytes

Versions: 6

Compression:

Stored size: 1018 Bytes

Contents

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

import User from '../../pb_user/_user'

type OptionProps = {
  children: React.ReactNode,
  label?: string,
  data: {
    imageUrl?: string,
  },
  selectProps: {
    dark?: boolean,
    valueComponent?: (data: {
      imageUrl?: string,
    }) => React.ReactNode,
  },
}


const Option = (props: OptionProps): React.ReactElement => {
  const {
    imageUrl,
  } = props.data
  const { valueComponent } = props.selectProps

  return (
    <components.Option {...props}>
      <>
        {!valueComponent && imageUrl &&
          <User
              align="left"
              avatarUrl={imageUrl}
              dark={props.selectProps.dark}
              name={props.label}
              orientation="horizontal"
          />
        }

        {valueComponent &&
          valueComponent(props.data)
        }

        {!valueComponent && !imageUrl &&
          props.label
        }
      </>
    </components.Option>
  )
}

export default Option

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
playbook_ui-14.11.1.pre.alpha.PLAY1750pbcontenttagkitbutton5341 app/pb_kits/playbook/pb_typeahead/components/Option.tsx
playbook_ui-14.11.1.pre.alpha.PLAY1750pbcontenttagkitbutton5340 app/pb_kits/playbook/pb_typeahead/components/Option.tsx
playbook_ui-14.11.1.pre.alpha.PLAY1750pbcontenttagkitbutton5339 app/pb_kits/playbook/pb_typeahead/components/Option.tsx
playbook_ui-14.12.0.pre.rc.3 app/pb_kits/playbook/pb_typeahead/components/Option.tsx
playbook_ui-14.10.0.pre.alpha.play1465attempt25272 app/pb_kits/playbook/pb_typeahead/components/Option.tsx
playbook_ui-13.31.0.pre.alpha.PLAY10863202 app/pb_kits/playbook/pb_typeahead/components/Option.tsx