Sha256: 1fc4b9f8522bbc6ffe30d3769effa8e178e86eb22048c98e05a412f0b012bf28

Contents?: true

Size: 1.75 KB

Versions: 192

Compression:

Stored size: 1.75 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, GlobalProps } from '../utilities/globalProps'

type FormPillProps = {
  className?: string,
  id?: string,
  text: string,
  name: string,
  onClick?: React.MouseEventHandler<HTMLSpanElement>,
  avatar?: boolean,
  avatarUrl?: string,
  size?: string,
  textTransform?: 'none' | 'lowercase',
  closeProps?: {
    onClick?: React.MouseEventHandler<HTMLSpanElement>,
    onMouseDown?: React.MouseEventHandler<HTMLSpanElement>,
    onTouchEnd?: React.TouchEventHandler<HTMLSpanElement>,
  }, 
} & GlobalProps
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}>
        {name &&
        <>
        <Avatar
            imageUrl={avatarUrl}
            name={name}
            size="xs"
            status={null}
        />
        <Title
            className="pb_form_pill_text"
            size={4}
            text={name}
        />
        </>
        }

      {text &&
        <Title
            className="pb_form_pill_tag"
            size={4}
            text={text}
        />
      }
      <div
          className="pb_form_pill_close"
          onClick={onClick}
          {...closeProps}
      >
        <Icon
            fixedWidth
            icon="times"
        />
      </div>
    </div>
  )
}
export default FormPill

Version data entries

192 entries across 192 versions & 1 rubygems

Version Path
playbook_ui-11.2.4.pre.alpha1 app/pb_kits/playbook/pb_form_pill/_form_pill.tsx
playbook_ui-11.2.3 app/pb_kits/playbook/pb_form_pill/_form_pill.tsx
playbook_ui-11.2.2 app/pb_kits/playbook/pb_form_pill/_form_pill.tsx
playbook_ui-11.2.1 app/pb_kits/playbook/pb_form_pill/_form_pill.tsx
playbook_ui-11.2.0 app/pb_kits/playbook/pb_form_pill/_form_pill.tsx
playbook_ui-11.1.2 app/pb_kits/playbook/pb_form_pill/_form_pill.tsx
playbook_ui-11.1.2.pre.alpha1 app/pb_kits/playbook/pb_form_pill/_form_pill.tsx
playbook_ui-11.1.1 app/pb_kits/playbook/pb_form_pill/_form_pill.tsx
playbook_ui-11.1.1.pre.alpha1 app/pb_kits/playbook/pb_form_pill/_form_pill.tsx
playbook_ui-11.1.0 app/pb_kits/playbook/pb_form_pill/_form_pill.tsx
playbook_ui-11.0.1 app/pb_kits/playbook/pb_form_pill/_form_pill.tsx
playbook_ui-11.0.0 app/pb_kits/playbook/pb_form_pill/_form_pill.tsx