Sha256: cc37c1eb860f2d7841a430afc36e8630184783c87a0d84567966ec693c8257bf

Contents?: true

Size: 1.53 KB

Versions: 48

Compression:

Stored size: 1.53 KB

Contents

/* @flow */
import React from 'react'
import classnames from 'classnames'
import Title from '../pb_title/_title.jsx'
import Icon from '../pb_icon/_icon.jsx'
import Avatar from '../pb_avatar/_avatar.jsx'
import { globalProps } from '../utilities/globalProps.js'

type FormPillProps = {
  className?: string,
  id?: string,
  text: string,
  name: string,
  onClick?: EventHandler,
  avatar?: boolean,
  avatarUrl?: string,
  size?: string,
  closeProps?: {
    onClick?: EventHandler,
    onMouseDown?: EventHandler,
    onTouchEnd?: EventHandler,
  },
}
const FormPill = (props: FormPillProps) => {
  const {
    className,
    text,
    name,
    onClick = () => {},
    avatarUrl,
    closeProps = {},
    size = '',
  } = props
  const css = classnames(
    `pb_form_pill_kit_${'primary'}`,
    globalProps(props),
    className,
    size === 'small' ? 'small' : null,
  )
  return (
    <div className={css}>
      <If condition={name}>
        <Avatar
            imageUrl={avatarUrl}
            name={name}
            size="xs"
        />
        <Title
            className="pb_form_pill_text"
            size={4}
            text={name}
        />
      </If>
      <If condition={text}>
        <Title
            className="pb_form_pill_tag"
            size={4}
            text={text}
        />
      </If>
      <div
          className="pb_form_pill_close"
          onClick={onClick}
          {...closeProps}
      >
        <Icon
            fixedWidth
            icon="times"
        />
      </div>
    </div>
  )
}
export default FormPill

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
playbook_ui-9.16.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-9.15.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-9.15.0.pre.decouple.website1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-9.14.1.alpha.radio.alignment app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-9.14.1.alpha.highcharts9 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-9.14.1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-9.13.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-9.9.0.alpha.inline1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx