From 2ccf3f4561fad2f0f6d54c9f73c5c9cbc452820c Mon Sep 17 00:00:00 2001 From: Melloware Date: Mon, 20 Jun 2022 08:05:58 -0400 Subject: [PATCH] Fix #2997: Badge 0 as a value not properly rendered (#2998) --- components/lib/badge/Badge.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/lib/badge/Badge.js b/components/lib/badge/Badge.js index 823d1c9b9d..67fba161b2 100644 --- a/components/lib/badge/Badge.js +++ b/components/lib/badge/Badge.js @@ -4,8 +4,8 @@ import { classNames, ObjectUtils } from '../utils/Utils'; export const Badge = React.memo(React.forwardRef((props, ref) => { const otherProps = ObjectUtils.findDiffKeys(props, Badge.defaultProps); const className = classNames('p-badge p-component', { - 'p-badge-no-gutter': props.value && String(props.value).length === 1, - 'p-badge-dot': !props.value, + 'p-badge-no-gutter': ObjectUtils.isNotEmpty(props.value) && String(props.value).length === 1, + 'p-badge-dot': ObjectUtils.isEmpty(props.value), 'p-badge-lg': props.size === 'large', 'p-badge-xl': props.size === 'xlarge', [`p-badge-${props.severity}`]: props.severity !== null