Skip to content

Commit

Permalink
Merge pull request #152 from FriedRiceNoodles/fix/tooltip
Browse files Browse the repository at this point in the history
fix(tooltip): fix a bug that make empty content shown when the trigge…
  • Loading branch information
FriedRiceNoodles authored Jun 18, 2024
2 parents 0c20185 + 4fedae7 commit dfac4d2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/shiny-balloons-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@banana-ui/banana': patch
'@banana-ui/react': patch
---

Fix a bug that make empty content shown when the trigger action is none.
4 changes: 4 additions & 0 deletions packages/banana/src/tooltip/index.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export default [
z-index: 100;
}
.tooltip__empty-content {
display: none;
}
.tooltip__content-body {
padding: var(--banana-tooltip-padding, ${unsafeCSS(Var.TooltipPadding)});
background-color: var(--banana-tooltip-background-color, ${unsafeCSS(Var.TooltipBackgroundColor)});
Expand Down
6 changes: 4 additions & 2 deletions packages/banana/src/tooltip/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,13 @@ export default class BTooltip extends LitElement {
@keydown=${this._onTriggerKeyDown}
></slot>
<div
class="tooltip__content"
class=${classMap({
tooltip__content: true,
'tooltip__empty-content': (this.content.length || 0) === 0,
})}
part="drop"
@mouseenter=${this._onContentMouseEnter}
@mouseleave=${this._onContentMouseLeave}
?hidden=${(this.content?.length || 0) === 0}
>
<slot name="content">
<div part="content" class="tooltip__content-body">${this.content}</div>
Expand Down

0 comments on commit dfac4d2

Please sign in to comment.