Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(design): improve styling of Tooltip (#4463)

白熱fcf5bbf2015d
diff --git a/packages/design/src/components/tooltip/Tooltip.stories.tsx b/packages/design/src/components/tooltip/Tooltip.stories.tsx
index b8a9e00108..35156f38c5 100644
--- a/packages/design/src/components/tooltip/Tooltip.stories.tsx
+++ b/packages/design/src/components/tooltip/Tooltip.stories.tsx
@@ -71,6 +71,18 @@ export const Playground = {
<div>
+ <Tooltip
+ title="https://docs.google.com/spreadsheets/d/1nt6WeRPP7E8LSUdJQZBetYJandjhNa4G6i-plp__hRA/edit?gid=0#gid=0"
+ showIfEllipsis
+ placement="bottom"
+ >
+ <div className="univer-w-72 univer-truncate">
+ https://docs.google.com/spreadsheets/d/1nt6WeRPP7E8LSUdJQZBetYJandjhNa4G6i-plp__hRA/edit?gid=0#gid=0
+ </div>
+ </Tooltip>
+ </div>
+
+ <div>
<Tooltip
title="完整的文本内容"
showIfEllipsis
diff --git a/packages/design/src/components/tooltip/Tooltip.tsx b/packages/design/src/components/tooltip/Tooltip.tsx
index 8949f8c4cb..28735a9305 100644
--- a/packages/design/src/components/tooltip/Tooltip.tsx
+++ b/packages/design/src/components/tooltip/Tooltip.tsx
@@ -290,8 +290,8 @@ export function Tooltip({ visible, asChild = false, title, children, placement =
<div
ref={tooltipRef}
className={clsx(`
- univer-pointer-events-none univer-fixed univer-z-[1100] univer-animate-in univer-fade-in-0
- univer-zoom-in-95 univer-duration-200 univer-opacity-0 univer-font-sans
+ univer-pointer-events-none univer-fixed univer-z-[1100] univer-font-sans univer-opacity-0
+ univer-duration-200 univer-animate-in univer-fade-in-0 univer-zoom-in-95
`, {
'univer-opacity-100': mounted,
'univer-slide-in-from-bottom-2': actualPlacement === 'top' && mounted,
@@ -309,15 +309,15 @@ export function Tooltip({ visible, asChild = false, title, children, placement =
<div className="univer-relative">
<div
className={`
- univer-max-w-[192px] univer-rounded-lg univer-bg-gray-700 univer-px-3 univer-py-2.5
- univer-text-xs univer-text-white univer-w-fit univer-font-medium
+ univer-w-fit univer-max-w-[192px] univer-break-words univer-rounded-lg univer-bg-gray-700
+ univer-px-3 univer-py-2.5 univer-text-xs univer-font-medium univer-text-white
`}
>
{title}
</div>
{/* Arrow */}
<div
- className={clsx('univer-absolute univer-w-2 univer-h-2 univer-rotate-45 univer-bg-gray-700', {
+ className={clsx('univer-absolute univer-h-2 univer-w-2 univer-rotate-45 univer-bg-gray-700', {
'-univer-bottom-1 univer-left-1/2 -univer-translate-x-1/2': actualPlacement === 'top',
'-univer-top-1 univer-left-1/2 -univer-translate-x-1/2': actualPlacement === 'bottom',
'-univer-right-1 univer-top-1/2 -univer-translate-y-1/2': actualPlacement === 'left',