Refactor #4211 - For Badge Directive

pull/4226/head
Tuğçe Küçükoğlu 2023-07-31 15:12:50 +03:00
parent f37a0a783e
commit 392f1476f0
2 changed files with 16 additions and 1 deletions

View File

@ -68,16 +68,27 @@ export interface BadgeContext {
info: boolean; info: boolean;
/** /**
* Current success state as a boolean. * Current success state as a boolean.
* @defaultValue false
*/ */
success: boolean; success: boolean;
/** /**
* Current warning state as a boolean. * Current warning state as a boolean.
* @defaultValue false
*/ */
warning: boolean; warning: boolean;
/** /**
* Current danger state as a boolean. * Current danger state as a boolean.
* @defaultValue false
*/ */
danger: boolean; danger: boolean;
/**
* Current gutter state as a boolean.
*/
nogutter: boolean;
/**
* Current dot state as a boolean.
*/
dot: boolean;
} }
/** /**

View File

@ -11,7 +11,11 @@ const BadgeDirective = BaseBadgeDirective.extend('badge', {
id, id,
class: !el.unstyled && this.cx('root'), class: !el.unstyled && this.cx('root'),
'p-bind': this.ptm('root', { 'p-bind': this.ptm('root', {
context: binding.modifiers context: {
...binding.modifiers,
nogutter: String(binding.value).length === 1,
dot: binding.value == null
}
}) })
}); });