Sha256: 672b196bf2a7806e7c683fb4b278dc9a4c4a1ffbb57067d6a6b1ba4d334cd2bb
Contents?: true
Size: 1.53 KB
Versions: 21
Compression:
Stored size: 1.53 KB
Contents
/* @flow */ import React from 'react' import classnames from 'classnames' import { globalProps } from '../utilities/globalProps.js' import { Icon } from '../' import { buildAriaProps, buildCss, buildDataProps, } from '../utilities/props' type BadgeProps = { aria?: object, className?: string, closeProps?: { onClick?: EventHandler, onMouseDown?: EventHandler, onTouchEnd?: EventHandler, }, data?: object, id?: string, removeIcon?: Boolean, removeOnClick?: EventHandler, rounded?: boolean, text?: string, variant?: "error" | "info" | "neutral" | "primary" | "success" | "warning", } const Badge = (props: BadgeProps) => { const { aria = {}, className, closeProps = {}, data = {}, id, removeIcon = false, removeOnClick = () => {}, 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} <If condition={removeIcon}> <span onClick={removeOnClick} style={{ cursor: 'pointer' }} {...closeProps} > <Icon fixedWidth icon="times" /> </span> </If> </span> </div> ) } export default Badge
Version data entries
21 entries across 21 versions & 1 rubygems