Fix notifications css

This commit is contained in:
2024-07-06 23:31:43 +07:00
parent a1ffd57e52
commit 668e3f42f4
3 changed files with 34 additions and 31 deletions
+12 -4
View File
@@ -10,12 +10,14 @@ const Header = () =>
children: [ children: [
notifications.DNDToggle({ notifications.DNDToggle({
className: "surface p10 round", className: "surface p10 round",
css: "min-width: 24px; min-height: 24px;", css: `
min-width: 24px;
min-height: 24px;
`,
hpack: "start", hpack: "start",
hexpand: true, hexpand: true,
}), }),
notifications.ClearButton({ notifications.ClearButton({
className: "surface p10 r100",
hpack: "end", hpack: "end",
hexpand: true, hexpand: true,
}), }),
@@ -28,10 +30,16 @@ export const Notifications = () =>
exclusivity: "exclusive", exclusivity: "exclusive",
transition: "slide_down", transition: "slide_down",
layout: "top-center", layout: "top-center",
duration: 300,
child: Widget.Box({ child: Widget.Box({
vertical: true, vertical: true,
className: "bgcont qs-container", className: "bgcont",
css: "min-width: 600px", css: `
min-width: 600px;
margin: 10px;
padding: 12px;
border-radius: 40px;
`,
children: children:
/** @type {any} */ /** @type {any} */
( (
+17 -9
View File
@@ -64,7 +64,7 @@ const NotificationIcon = ({ app_entry, app_icon, image }) => {
return Widget.Box({ return Widget.Box({
vpack: "start", vpack: "start",
hexpand: false, hexpand: false,
class_name: "icon img", className: "r20",
css: ` css: `
background-image: url("${image}"); background-image: url("${image}");
background-size: cover; background-size: cover;
@@ -72,6 +72,7 @@ const NotificationIcon = ({ app_entry, app_icon, image }) => {
background-position: center; background-position: center;
min-width: 78px; min-width: 78px;
min-height: 78px; min-height: 78px;
margin-right: 12px;
`, `,
}); });
} }
@@ -83,10 +84,11 @@ const NotificationIcon = ({ app_entry, app_icon, image }) => {
return Widget.Box({ return Widget.Box({
vpack: "start", vpack: "start",
hexpand: false, hexpand: false,
class_name: "icon", className: "r20",
css: ` css: `
min-width: 78px; min-width: 78px;
min-height: 78px; min-height: 78px;
margin-right: 12px;
`, `,
child: Widget.Icon({ child: Widget.Icon({
icon, icon,
@@ -108,7 +110,6 @@ const time = (time, format = "%H:%M") =>
/** @param {import("types/service/notifications").Notification} notification */ /** @param {import("types/service/notifications").Notification} notification */
export const Notification = (notification) => { export const Notification = (notification) => {
const content = Widget.Box({ const content = Widget.Box({
className: "content",
children: [ children: [
NotificationIcon(notification), NotificationIcon(notification),
Widget.Box({ Widget.Box({
@@ -118,7 +119,10 @@ export const Notification = (notification) => {
Widget.Box({ Widget.Box({
children: [ children: [
Widget.Label({ Widget.Label({
class_name: "title", css: `
font-size: 1.1em;
margin-right: 12pt;
`,
xalign: 0, xalign: 0,
justification: "left", justification: "left",
hexpand: true, hexpand: true,
@@ -129,12 +133,15 @@ export const Notification = (notification) => {
use_markup: true, use_markup: true,
}), }),
Widget.Label({ Widget.Label({
class_name: "time",
vpack: "start", vpack: "start",
label: time(notification.time), label: time(notification.time),
}), }),
Widget.Button({ Widget.Button({
class_name: "close-button", css: `
margin-left: 6pt;
min-width: 1.2em;
min-height: 1.2em;
`,
vpack: "start", vpack: "start",
child: Widget.Icon("window-close-symbolic"), child: Widget.Icon("window-close-symbolic"),
on_clicked: notification.close, on_clicked: notification.close,
@@ -142,7 +149,7 @@ export const Notification = (notification) => {
], ],
}), }),
Widget.Label({ Widget.Label({
class_name: "description", css: "font-size: .9em;",
hexpand: true, hexpand: true,
use_markup: true, use_markup: true,
xalign: 0, xalign: 0,
@@ -165,7 +172,7 @@ export const Notification = (notification) => {
class_name: "actions horizontal", class_name: "actions horizontal",
children: notification.actions.map((action) => children: notification.actions.map((action) =>
Widget.Button({ Widget.Button({
class_name: "action-button", className: "button",
on_clicked: () => notification.invoke(action.id), on_clicked: () => notification.invoke(action.id),
hexpand: true, hexpand: true,
child: Widget.Label(action.label), child: Widget.Label(action.label),
@@ -194,7 +201,7 @@ export const Notification = (notification) => {
}); });
return Widget.Box({ return Widget.Box({
class_name: `surface r20 p10 notification ${notification.urgency}`, className: "surface r20 p10",
css: "margin: 8px 0;", css: "margin: 8px 0;",
child: eventbox, child: eventbox,
}); });
@@ -238,6 +245,7 @@ export const Placeholder = (props) =>
/** @param {import("types/widgets/button").ButtonProps} props */ /** @param {import("types/widgets/button").ButtonProps} props */
export const ClearButton = (props) => export const ClearButton = (props) =>
Widget.Button({ Widget.Button({
className: "button surface",
onClicked: () => notifications.clear(), onClicked: () => notifications.clear(),
sensitive: notifications.bind("notifications").as((x) => x.length > 0), sensitive: notifications.bind("notifications").as((x) => x.length > 0),
child: Widget.Box({ child: Widget.Box({
+5 -18
View File
@@ -67,6 +67,11 @@
min-height: 1px; min-height: 1px;
} }
.button {
border-radius: 20px;
padding: 10px;
}
/* Slider */ /* Slider */
slider { slider {
box-shadow: none; box-shadow: none;
@@ -197,21 +202,3 @@ mark {
min-width: 4px; min-width: 4px;
background-color: #fff; background-color: #fff;
} }
.powermenu {
padding: 20px;
border-radius: 30px;
}
.powermenu button image {
margin: 10px;
border-radius: 10px;
min-width: 120px;
min-height: 120px;
font-size: 68px;
}
.powermenu button:hover image, .powermenu button:focus image {
background-color: #11111B;
color: #94e2d5;
}