Skip to content

Commit fac01bb

Browse files
committed
[IMP] demo: improve notification styling
The notifications were quite ugly in o-spreadsheet demo. This commit adds a bit of styling to make them look better. closes #7457 Task: 5261751 Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
1 parent c75e9f3 commit fac01bb

File tree

2 files changed

+35
-10
lines changed

2 files changed

+35
-10
lines changed

demo/main.css

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,30 @@ body {
77
"Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
88
"Noto Color Emoji" !important;
99
}
10+
11+
.o-spreadsheet .o-test-notification {
12+
position: absolute;
13+
right: 10px;
14+
top: 10px;
15+
border: 1px solid var(--os-gray-300);
16+
border-left-width: 5px;
17+
border-left-style: solid;
18+
z-index: 10000;
19+
width: 400px;
20+
21+
&.info {
22+
border-left-color: var(--bs-info);
23+
}
24+
25+
&.warning {
26+
border-left-color: var(--bs-warning);
27+
}
28+
29+
&.danger {
30+
border-left-color: var(--bs-danger);
31+
}
32+
33+
&.success {
34+
border-left-color: var(--bs-success);
35+
}
36+
}

demo/main.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,6 @@ const { useStoreProvider } = o_spreadsheet.stores;
2626

2727
const uuidGenerator = new o_spreadsheet.helpers.UuidGenerator();
2828

29-
const NOTIFICATION_STYLE =
30-
"position:absolute;\
31-
right:0px;\
32-
border:2px solid black;\
33-
background:#F5F5DCD5;\
34-
padding:20px;\
35-
z-index:10000;\
36-
width:140px;";
37-
3829
topbarMenuRegistry.addChild("reload", ["file"], {
3930
name: "Clear & reload demo",
4031
sequence: 10,
@@ -311,7 +302,14 @@ class Demo extends Component {
311302
const div = document.createElement("div");
312303
const text = document.createTextNode(notification.text);
313304
div.appendChild(text);
314-
div.style = NOTIFICATION_STYLE;
305+
div.classList.add(
306+
"o-test-notification",
307+
"bg-white",
308+
"p-3",
309+
"shadow",
310+
"rounded",
311+
notification.type
312+
);
315313
const element = document.querySelector(".o-spreadsheet") || document.body; // if we crash on launch, the spreadsheet is not mounted yet
316314
div.onclick = () => {
317315
element.removeChild(div);

0 commit comments

Comments
 (0)