Sha256: 1da2dae7a8d4011a8958acac7e722afbd7293ed33e4b2ffa906cd50f743dc1c2

Contents?: true

Size: 1.61 KB

Versions: 19

Compression:

Stored size: 1.61 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,
  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

19 entries across 19 versions & 1 rubygems

Version Path
playbook_ui-10.23.0.pre.cachetest app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.21.0.pre.alpha.lightbox.2 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.21.0.pre.alpha.lightbox app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.21.0.pre.alpha.rg1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.21.0.pre.alpha.jg1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.21.0.pre.alpha.na1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.21.0.pre.alpha.jd1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.20.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.19.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.19.0.pre.lightbox app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.18.2 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.19.0.pre.popover.alpha1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.18.1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.18.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.17.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.16.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.15.1 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.15.1.pre.alpha.rubocop.deps app/pb_kits/playbook/pb_form_pill/_form_pill.jsx
playbook_ui-10.15.0 app/pb_kits/playbook/pb_form_pill/_form_pill.jsx