Sha256: 91958bad0280757d30b83324df2c16ed37be6a3acdf9917dab27db51dc2fc19d

Contents?: true

Size: 1.02 KB

Versions: 16

Compression:

Stored size: 1.02 KB

Contents

/* @flow */

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

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

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

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

export default Badge

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
playbook_ui-6.0.1.pre.alpha5 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-6.0.1.pre.alpha4 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-6.0.1.pre.alpha3 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-6.0.1.pre.alpha2 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-6.0.1 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-6.0.0 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-5.5.1.pre.alpha4 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-5.5.1.pre.alpha3 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-5.5.1.pre.alpha2 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-5.5.1.pre.alpha1 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-5.5.1 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-5.5.0 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-5.5.0.pre.alpha1 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-5.3.0.pre.alpha1 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-5.4.0 app/pb_kits/playbook/pb_badge/_badge.jsx
playbook_ui-5.3.0 app/pb_kits/playbook/pb_badge/_badge.jsx