Sha256: 28f78e0495e02aa8ae8a94bc158f9d3fb9fe88b0b7c0ee1391091b8e9a9e1d6e

Contents?: true

Size: 979 Bytes

Versions: 132

Compression:

Stored size: 979 Bytes

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'
import { globalProps } from '../utilities/globalProps.js'

import {
  buildAriaProps,
  buildCss,
  buildDataProps,
} from '../utilities/props'

type BadgeProps = {
  aria?: object,
  className?: string,
  data?: object,
  id?: string,
  rounded?: boolean,
  text?: string,
  variant?: "error" | "info" | "neutral" | "primary" | "success" | "warning",
}
const Badge = (props: BadgeProps) => {
  const {
    aria = {},
    className,
    data = {},
    id,
    rounded = false,
    text,
    variant = 'neutral',
  } = props
  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)
  const css = classnames(
    buildCss('pb_badge_kit', variant, { rounded }),
    globalProps(props),
    className
  )

  return (
    <div
        {...ariaProps}
        {...dataProps}
        className={css}
        id={id}
    >
      <span>{text}</span>
    </div>
  )
}

export default Badge

Version data entries

132 entries across 132 versions & 1 rubygems

Version Path
playbook_ui-8.4.0.alpha.dependencies.2 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-8.4.0.alpha.dependencies.1 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-8.2.0.pre.alpha4 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-8.2.0.pre.alpha3 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-8.2.0 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-8.1.2 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-8.0.3 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-8.2.0.pre.alpha2 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-8.1.1 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-8.0.2 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-8.2.0.pre.alpha1 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-8.1.0 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-8.0.1 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-8.0.0 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-8.0.0.pre.alpha5 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-8.0.0.pre.alpha4 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-8.0.0.pre.alpha1 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-7.16.0.pre.alpha5 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-7.16.0.pre.alpha4 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-7.16.0.pre.alpha3 app/pb_kits/playbook/pb_badge/_badge.jsx