Skip to content

Commit

Permalink
Cleanup (deephaven#1909)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Apr 11, 2024
1 parent 55d0fc2 commit 9f4c1fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/components/src/spectrum/ItemContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function ItemContent({
// <Text>Some Label</Text>
// <Text slot="description">Some Description</Text>
// </Item>
content = Children.map(content, (el, i) =>
content = Children.map(content, el =>
isElementOfType(el, Text)
? cloneElement(el, {
...el.props,
Expand Down
10 changes: 6 additions & 4 deletions packages/components/src/spectrum/ItemTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ export interface ItemTooltipProps {
options: TooltipOptions;
}

/**
* Tooltip for `<Item>` content.
*/
export function ItemTooltip({
children,
options,
}: ItemTooltipProps): JSX.Element {
if (typeof children === 'boolean') {
return <Tooltip options={options}>{children}</Tooltip>;
}

if (Array.isArray(children)) {
return (
<Tooltip options={options}>
{/* Multiple children scenarios include a `<Text>` node for the label
and at least 1 of an optional icon or `<Text slot="description">` node.
In such cases we only show the label and description `<Text>` nodes. */}
<Flex direction="column" alignItems="start">
{children.filter(node => isElementOfType(node, Text))}
</Flex>
Expand Down

0 comments on commit 9f4c1fb

Please sign in to comment.