Skip to content

Commit

Permalink
feat(list-item): Add tooltip for expanding and collapsing (#8612)
Browse files Browse the repository at this point in the history
**Related Issue:** #8613

## Summary

- Adds tooltip for expand/collapse button.
  • Loading branch information
driskull committed Jan 16, 2024
1 parent 4ec6b94 commit 4964491
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
@@ -1,3 +1,5 @@
{
"close": "Close"
"close": "Close",
"expand": "Expand",
"collapse": "Collapse"
}
@@ -1,3 +1,5 @@
{
"close": "Close"
"close": "Close",
"expand": "Expand",
"collapse": "Collapse"
}
Expand Up @@ -471,12 +471,18 @@ export class ListItem
}

renderOpen(): VNode {
const { el, open, openable } = this;
const { el, open, openable, messages } = this;
const dir = getElementDir(el);
const icon = open ? ICONS.open : dir === "rtl" ? ICONS.closedRTL : ICONS.closedLTR;
const tooltip = open ? messages.collapse : messages.expand;

return openable ? (
<td class={CSS.openContainer} key="open-container" onClick={this.handleToggleClick}>
<td
class={CSS.openContainer}
key="open-container"
onClick={this.handleToggleClick}
title={tooltip}
>
<calcite-icon icon={icon} key={icon} scale="s" />
</td>
) : null;
Expand Down

0 comments on commit 4964491

Please sign in to comment.