Skip to content

Commit

Permalink
fix: issue with tooltip inside tag (#3272)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmerget authored Nov 5, 2024
1 parent 905c14b commit eae31d0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/components/src/components/tag/tag.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
display: none;
}

> [class^="db-"] {
> :is([class="db-checkbox"], [class="db-radio"], [class="db-link"], [class="db-button"]) {
block-size: 100%;
}
}
Expand Down
12 changes: 12 additions & 0 deletions showcases/patternhub/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,18 @@ export const getCodeByFramework = (
return `<${tag}${className} ${attributes.join(' ')}${reactSlots}/>`;
}

// Workaround for tooltip
if (componentName === 'tooltip') {
return innerContent.replace(
'</',
`<${tag}${className} ${attributes
.filter((attr) => attr !== 'content')
.join(' ')}>${
attributes.find((attr) => attr === 'content') ?? ''
}</${tag}></`
);
}

return `<${tag}${className} ${attributes.join(' ')}${reactSlots}>
${otherSlots}${innerContent}
</${tag}>`;
Expand Down

0 comments on commit eae31d0

Please sign in to comment.