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-10.14.1.pre.alpha2 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.14.1.pre.alpha1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.14.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.13.1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.13.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.13.0.pre.node.update app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.12.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.11.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.10.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.9.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.8.1.pre.alpha.flexdeps app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.9.0.pre.alpha1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.8.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.7.1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.7.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.6.2.pre.alpha.dep app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.6.1.pre.alpha1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.6.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.5.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.4.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx