Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix: prevent notification text from covering close button (#17684)

nightcitybladefc03eac491b6
diff --git a/src/components/HighlightNotification/index.test.tsx b/src/components/HighlightNotification/index.test.tsx
new file mode 100644
index 00000000000..4418fd09772
--- /dev/null
+++ b/src/components/HighlightNotification/index.test.tsx
@@ -0,0 +1,27 @@
+import { fireEvent, render, screen } from '@testing-library/react';
+import { describe, expect, it, vi } from 'vitest';
+
+import HighlightNotification from '.';
+
+describe('HighlightNotification', () => {
+ it('keeps long notification copy clear of the visible close action', () => {
+ const onClose = vi.fn();
+ const title = 'WeChat Integration Service Update';
+ const description =
+ 'Using WeChat integration will require a paid plan starting from July 10. Learn More';
+
+ render(
+ <HighlightNotification open description={description} title={title} onClose={onClose} />,
+ );
+
+ const copy = screen.getByText(title).parentElement;
+ const closeButton = screen.getByRole('button');
+
+ expect(copy).toHaveStyle({ paddingInlineEnd: '32px' });
+ expect(screen.getByText(description)).toBeVisible();
+ expect(closeButton).toBeVisible();
+
+ fireEvent.click(closeButton);
+ expect(onClose).toHaveBeenCalledOnce();
+ });
+});
diff --git a/src/components/HighlightNotification/index.tsx b/src/components/HighlightNotification/index.tsx
index 19799edff70..fdc4724068d 100644
--- a/src/components/HighlightNotification/index.tsx
+++ b/src/components/HighlightNotification/index.tsx
@@ -103,8 +103,12 @@ const HighlightNotification = memo<HighlightNotificationProps>(
<Flexbox gap={0}>
{image && <img alt="" className={styles.image} src={image} />}
<Flexbox gap={4} padding={12}>
- {title && <div className={styles.title}>{title}</div>}
- {description && <div className={styles.description}>{description}</div>}
+ {(title || description) && (
+ <Flexbox gap={4} style={{ paddingInlineEnd: 32 }}>
+ {title && <div className={styles.title}>{title}</div>}
+ {description && <div className={styles.description}>{description}</div>}
+ </Flexbox>
+ )}
{actionLabel && actionHref && (
<a
className={styles.action}