mirror of
https://github.com/tuxdotrs/tpanel.git
synced 2025-10-10 12:51:54 +05:30
refactor: update notifications style
This commit is contained in:
@@ -10,16 +10,35 @@ window.notifications {
|
|||||||
padding: 20px;
|
padding: 20px;
|
||||||
border-radius: $rounded;
|
border-radius: $rounded;
|
||||||
min-width: 20rem;
|
min-width: 20rem;
|
||||||
border: 1px solid transparent;
|
|
||||||
|
.header {
|
||||||
|
.app-icon {
|
||||||
|
-gtk-icon-size: 2rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
.image {
|
||||||
|
-gtk-icon-size: 4rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
button {
|
||||||
|
background: $inactive-color;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: $rounded;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: $bg-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.critical {
|
&.critical {
|
||||||
border: 1px solid rgba(red, 0.5);
|
border: 1px solid rgba(red, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.normal {
|
|
||||||
border: 1px solid rgba(yellow, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
color: rgba($fg-color, 0.8);
|
color: rgba($fg-color, 0.8);
|
||||||
|
|
||||||
|
@@ -30,15 +30,19 @@ const urgency = (n: AstalNotifd.Notification) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const { VERTICAL } = Gtk.Orientation;
|
||||||
|
const { START, END, CENTER } = Gtk.Align;
|
||||||
|
|
||||||
export const Notification = ({ n }: { n: AstalNotifd.Notification }) => {
|
export const Notification = ({ n }: { n: AstalNotifd.Notification }) => {
|
||||||
return (
|
return (
|
||||||
<Adw.Clamp maximumSize={400}>
|
<Adw.Clamp maximumSize={400}>
|
||||||
<box
|
<box
|
||||||
widthRequest={400}
|
widthRequest={400}
|
||||||
class={`notification ${urgency(n)}`}
|
class={`notification ${urgency(n)}`}
|
||||||
orientation={Gtk.Orientation.VERTICAL}
|
orientation={VERTICAL}
|
||||||
|
spacing={20}
|
||||||
>
|
>
|
||||||
<box class="header">
|
<box class="header" spacing={10}>
|
||||||
{(n.appIcon || isIcon(n.desktopEntry)) && (
|
{(n.appIcon || isIcon(n.desktopEntry)) && (
|
||||||
<image
|
<image
|
||||||
class="app-icon"
|
class="app-icon"
|
||||||
@@ -48,38 +52,28 @@ export const Notification = ({ n }: { n: AstalNotifd.Notification }) => {
|
|||||||
)}
|
)}
|
||||||
<label
|
<label
|
||||||
class="app-name"
|
class="app-name"
|
||||||
halign={Gtk.Align.START}
|
halign={START}
|
||||||
ellipsize={Pango.EllipsizeMode.END}
|
ellipsize={Pango.EllipsizeMode.END}
|
||||||
label={n.appName || "Unknown"}
|
label={n.appName || "Unknown"}
|
||||||
/>
|
/>
|
||||||
<label
|
<label class="time" hexpand halign={END} label={time(n.time)} />
|
||||||
class="time"
|
|
||||||
hexpand
|
|
||||||
halign={Gtk.Align.END}
|
|
||||||
label={time(n.time)}
|
|
||||||
/>
|
|
||||||
<button onClicked={() => n.dismiss()}>
|
<button onClicked={() => n.dismiss()}>
|
||||||
<image iconName="window-close-symbolic" />
|
<image iconName="window-close-symbolic" />
|
||||||
</button>
|
</button>
|
||||||
</box>
|
</box>
|
||||||
<Gtk.Separator visible />
|
<box class="content" spacing={10}>
|
||||||
<box class="content">
|
|
||||||
{n.image && fileExists(n.image) && (
|
{n.image && fileExists(n.image) && (
|
||||||
<image valign={Gtk.Align.START} class="image" file={n.image} />
|
<image valign={START} class="image" file={n.image} />
|
||||||
)}
|
)}
|
||||||
{n.image && isIcon(n.image) && (
|
{n.image && isIcon(n.image) && (
|
||||||
<box valign={Gtk.Align.START} class="icon-image">
|
<box valign={START} class="icon-image">
|
||||||
<image
|
<image iconName={n.image} halign={CENTER} valign={CENTER} />
|
||||||
iconName={n.image}
|
|
||||||
halign={Gtk.Align.CENTER}
|
|
||||||
valign={Gtk.Align.CENTER}
|
|
||||||
/>
|
|
||||||
</box>
|
</box>
|
||||||
)}
|
)}
|
||||||
<box orientation={Gtk.Orientation.VERTICAL}>
|
<box orientation={VERTICAL} valign={CENTER}>
|
||||||
<label
|
<label
|
||||||
class="summary"
|
class="summary"
|
||||||
halign={Gtk.Align.START}
|
halign={START}
|
||||||
xalign={0}
|
xalign={0}
|
||||||
label={n.summary}
|
label={n.summary}
|
||||||
ellipsize={Pango.EllipsizeMode.END}
|
ellipsize={Pango.EllipsizeMode.END}
|
||||||
@@ -89,7 +83,7 @@ export const Notification = ({ n }: { n: AstalNotifd.Notification }) => {
|
|||||||
class="body"
|
class="body"
|
||||||
wrap
|
wrap
|
||||||
useMarkup
|
useMarkup
|
||||||
halign={Gtk.Align.START}
|
halign={START}
|
||||||
xalign={0}
|
xalign={0}
|
||||||
justify={Gtk.Justification.FILL}
|
justify={Gtk.Justification.FILL}
|
||||||
label={n.body}
|
label={n.body}
|
||||||
@@ -98,10 +92,14 @@ export const Notification = ({ n }: { n: AstalNotifd.Notification }) => {
|
|||||||
</box>
|
</box>
|
||||||
</box>
|
</box>
|
||||||
{n.actions.length > 0 && (
|
{n.actions.length > 0 && (
|
||||||
<box class="actions">
|
<box class="actions" spacing={5}>
|
||||||
{n.actions.map(({ label, id }) => (
|
{n.actions.map(({ label, id }) => (
|
||||||
<button hexpand onClicked={() => n.invoke(id)}>
|
<button
|
||||||
<label label={label} halign={Gtk.Align.CENTER} hexpand />
|
hexpand
|
||||||
|
cursor={Gdk.Cursor.new_from_name("pointer", null)}
|
||||||
|
onClicked={() => n.invoke(id)}
|
||||||
|
>
|
||||||
|
<label label={label} halign={CENTER} hexpand />
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</box>
|
</box>
|
||||||
|
Reference in New Issue
Block a user