Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): show the toast close icon

Yudhi Armyndharis297796c1e375
diff --git a/dashboard/src/components/Toast.css b/dashboard/src/components/Toast.css
index b878b2ea0..aa29f9498 100644
--- a/dashboard/src/components/Toast.css
+++ b/dashboard/src/components/Toast.css
@@ -97,6 +97,7 @@
justify-content: center;
width: 24px;
height: 24px;
+ padding: 0;
border-radius: 6px;
border: none;
background: transparent;
diff --git a/dashboard/src/components/Toast.css.test.ts b/dashboard/src/components/Toast.css.test.ts
new file mode 100644
index 000000000..3a2d96fc2
--- /dev/null
+++ b/dashboard/src/components/Toast.css.test.ts
@@ -0,0 +1,20 @@
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import { readFileSync } from 'node:fs';
+import { fileURLToPath } from 'node:url';
+import { dirname, join } from 'node:path';
+
+const css = readFileSync(join(dirname(fileURLToPath(import.meta.url)), 'Toast.css'), 'utf8').replace(
+ /\/\*[\s\S]*?\*\//g,
+ '',
+);
+const body = (selector: string): string => {
+ const rule = new RegExp(`(?:^|})\\s*${selector.replace(/[.]/g, '\\.')}\\s*\\{([^}]*)\\}`).exec(css);
+ assert.ok(rule, `Toast.css has no ${selector} rule`);
+ return rule[1];
+};
+
+test('the toast close button resets the global button padding', () => {
+ // The global button rule pads 0.6em 1.2em; on a 24px box that leaves the 16px icon no width and it collapses.
+ assert.match(body('.toast-close'), /(?:^|;)\s*padding:\s*0\s*;/);
+});