Skip to content

Commit

Permalink
Library: Add StatusPage Demo (#256)
Browse files Browse the repository at this point in the history
* Create a Scrollbar Folder in demos

add a main.blp, a main.css, a main.js and a main.json file
implement basic display of a scrollbar and style it

* add a default status page that can be customized

* Add dynamism on the status page

add test cases and different displays based on input
update the main.json file with sample data

* move the scrollbar demo to a different feature

* add the missing js components in Blueprint

* take out uneccessary lines in main.js

* change the color in main.css to a named color

* debug a persistent file issue

* made recommended fixes

* update widgets to follow Gnome standards

Display not consistent with what was required
Help in centralising all content and increasing the size of the search field

* format the code to meet gnome standards

* fix: dangling comma in JSON

---------

Co-authored-by: Andy Holmes <andrew.g.r.holmes@gmail.com>
  • Loading branch information
Datagirlcmr and andyholmes committed Jun 21, 2023
1 parent 51009c7 commit 98d7abb
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/Library/demos/Status Page/main.blp
@@ -0,0 +1,44 @@
using Gtk 4.0;
using Adw 1;

Box {
orientation: vertical;
margin-top: 10;
vexpand:true;

Box {
spacing: 12;
orientation:horizontal;
halign:center;

Entry entry_1 {
placeholder-text: _("Type to Start Searching… (Keywords: Error, No results)");
}

Button submit_button {
name: "submit";
label: _("Submit");
}
}

Adw.StatusPage content {
title: _("No results found");
description: _("Try a different Search.");
icon-name: 'edit-find-symbolic';

Box {
margin-top: 18;
orientation:horizontal;
halign:center;

LinkButton {
label: "API Reference";
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.0.0-alpha.1/class.StatusPage.html";
}
LinkButton {
label: " Entry Tutorial";
uri: "https://developer.gnome.org/documentation/tutorials/beginners/components/entry.html";
}
}
}
}
Empty file.
15 changes: 15 additions & 0 deletions src/Library/demos/Status Page/main.js
@@ -0,0 +1,15 @@
const content = workbench.builder.get_object("content");
const entry = workbench.builder.get_object("entry_1");
const button = workbench.builder.get_object("submit_button");

button.connect("clicked", () => {
const text = entry.get_text();
if (text === "Error") {
content.title = "Error connecting to server";
} else if (text === "No results") {
content.title = "No results found";
} else {
content.title = "No content available for this keyword.";
}
});

10 changes: 10 additions & 0 deletions src/Library/demos/Status Page/main.json
@@ -0,0 +1,10 @@
{
"name": "Status Page",
"category": "user_interface",
"description": "A page used for empty/error states and similar use-cases.",
"panels": [
"ui",
"preview"
],
"autorun": true
}

0 comments on commit 98d7abb

Please sign in to comment.