Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions src/Library/demos/Banner/main.blp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Gtk 4.0;
using Adw 1;

Box {
orientation: vertical;

Adw.Banner banner {
button-label: _("Troubleshoot");
title: _("An error occurred: Could not resolve host");
revealed: true;
}

Adw.ToastOverlay overlay {
Adw.StatusPage {
title: _("Banner");
description: _("A bar with contextual information");
vexpand: true;

Box {
orientation: vertical;
halign: center;

Button button_show_banner {
halign: center;
label: _("Show Banner");

styles ["pill"]
}

Box {
margin-top: 24;
margin-bottom: 24;
orientation: vertical;

LinkButton {
label: "API Reference";
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.3/class.Banner.html";
}

LinkButton {
label: "Human Interface Guidelines";
uri: "https://developer.gnome.org/hig/patterns/feedback/banners.html";
}
}
}
}
}
}
23 changes: 23 additions & 0 deletions src/Library/demos/Banner/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import Adw from "gi://Adw";

const banner = workbench.builder.get_object("banner");
const overlay = workbench.builder.get_object("overlay");
const button_show_banner = workbench.builder.get_object("button_show_banner");

function alert() {
const toast = new Adw.Toast({
title: "Troubleshoot successful!",
timeout: 3,
});

overlay.add_toast(toast);
}

banner.connect("button-clicked", () => {
alert();
banner.revealed = false;
});

button_show_banner.connect("clicked", () => {
banner.revealed = true;
});
10 changes: 10 additions & 0 deletions src/Library/demos/Banner/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "Banner",
"category": "feedback",
"description": "A bar with contextual information",
"panels": [
"ui",
"preview"
],
"autorun": true
}