Skip to content

Commit

Permalink
fix(ui5-button-badge): remove text when in attention dot mode (#10768)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsanislavgatev authored Feb 4, 2025
1 parent 0ebc0f4 commit 641fac8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions packages/main/src/ButtonBadge.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
import type ButtonBadgeDesign from "./types/ButtonBadgeDesign.js";
import ButtonBadgeDesign from "./types/ButtonBadgeDesign.js";
import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
import ButtonBadgeTemplate from "./ButtonBadgeTemplate.js";

Expand Down Expand Up @@ -42,12 +42,16 @@ class ButtonBadge extends UI5Element {
/**
* Defines the text of the component.
*
* **Note:** Text is not needed when the `design` property is set to `AttentionDot`.
* **Note:** Text is not applied when the `design` property is set to `AttentionDot`.
* @since 2.7.0
* @public
*/
@property()
text: string = "";

get effectiveText() {
return this.design === ButtonBadgeDesign.AttentionDot ? "" : this.text;
}
}

ButtonBadge.define();
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/ButtonBadgeTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import type ButtonBadge from "./ButtonBadge.js";
import Tag from "./Tag.js";

export default function ButtonTemplate(this: ButtonBadge) {
return <Tag design="Critical" hide-state-icon>{this.text}</Tag>;
return <Tag design="Critical" hide-state-icon>{this.effectiveText}</Tag>;
}

0 comments on commit 641fac8

Please sign in to comment.