UNPKG

phx-react

Version:

PHX REACT

12 lines 1.34 kB
import React from 'react'; import { classNames } from '../types'; export function PHXBadge(_a) { var text = _a.text, _b = _a.type, type = _b === void 0 ? 'default' : _b, className = _a.className, removeButton = _a.removeButton, onClick = _a.onClick; var typeClassName = classNames(type === 'default' && 'bg-[#e4e4e4] text-[#616161]', type === 'success' && 'bg-[#cdfee1] text-[#0c5132]', type === 'informational' && 'bg-[#e0f0ff] text-[#00527c]', type === 'attention' && 'bg-[#ffef9d] text-[#4f4700]', type === 'warning' && 'bg-[#ffd6a4] text-[#5e4200]', type === 'danger' && 'bg-[#fedad9] text-[#8e1f0b]'); return (React.createElement("span", { className: classNames("rounded-lg py-0.5 text-xs font-normal leading-4 ".concat(typeClassName, " ").concat(className), removeButton ? 'pl-2 pr-0 flex items-center w-fit' : 'px-2') }, text, removeButton && (React.createElement("button", { onClick: onClick, className: 'px-0.5 ml-1 py-0.5 rounded-lg hover:bg-gray-300' }, React.createElement("svg", { xmlns: 'http://www.w3.org/2000/svg', fill: 'none', viewBox: '0 0 24 24', strokeWidth: '1.5', stroke: 'currentColor', className: 'w-3 h-3' }, React.createElement("path", { strokeLinecap: 'round', strokeLinejoin: 'round', d: 'M6 18L18 6M6 6l12 12' })))))); } //# sourceMappingURL=Badge.js.map