Sha256: 84b4d0b3e56eac1a891c3b47b1c74c6453e3d4468ff1e86078a80028c22dfc52

Contents?: true

Size: 1.6 KB

Versions: 8

Compression:

Stored size: 1.6 KB

Contents

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

type FormPillProps = {
  className?: string,
  id?: string,
  text: string,
  name: string,
  onClick?: EventHandler,
  avatar?: boolean,
  avatarUrl?: string,
  size?: string,
  textTransform?: "none" | "lowercase",
  closeProps?: {
    onClick?: EventHandler,
    onMouseDown?: EventHandler,
    onTouchEnd?: EventHandler,
  },
}
const FormPill = (props: FormPillProps) => {
  const {
    className,
    text,
    name,
    onClick = () => {},
    avatarUrl,
    closeProps = {},
    size = '',
    textTransform = 'none',
  } = props
  const css = classnames(
    `pb_form_pill_kit_${'primary'}`,
    globalProps(props),
    className,
    size === 'small' ? 'small' : null,
    textTransform,
  )
  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

8 entries across 8 versions & 1 rubygems

Version Path
playbook_ui-11.0.0.pre.alpha.2 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-11.0.0.pre.alpha.1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.26.1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.27.0.pre.lazysizes1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.27.0.pre.datepicker1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.26.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.26.0.pre.alpha5 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.26.0.pre.rc1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx