From f13f8b4cda8c64b4676ae564206a597ae8a1444e Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 11 Mar 2026 05:00:47 +0100 Subject: restore old search ui --- ui/src/components/mod.rs | 1 + ui/src/components/search.rs | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 ui/src/components/search.rs (limited to 'ui/src/components') diff --git a/ui/src/components/mod.rs b/ui/src/components/mod.rs index 3dd43a4..0161e7b 100644 --- a/ui/src/components/mod.rs +++ b/ui/src/components/mod.rs @@ -15,3 +15,4 @@ pub mod node_page; pub mod props; pub mod stats; pub mod user; +pub mod search; diff --git a/ui/src/components/search.rs b/ui/src/components/search.rs new file mode 100644 index 0000000..3d320cf --- /dev/null +++ b/ui/src/components/search.rs @@ -0,0 +1,31 @@ +/* + This file is part of jellything (https://codeberg.org/metamuffin/jellything) + which is licensed under the GNU Affero General Public License (version 3); see /COPYING. + Copyright (C) 2026 metamuffin +*/ + +use crate::{RenderInfo, components::node_card::NodeCard, page}; +use jellycommon::{Nku, routes::u_items_cont}; +use jellyui_locale::tr; + +page!(Search<'_>, |x| tr(x.ri.lang, "search")); + +markup::define! { + Search<'a>(ri: &'a RenderInfo<'a>, query: &'a str, items: &'a [Nku<'a>], cont: Option) { + .search { + h1 { @tr(ri.lang, "search") } + form[action="", method="GET"] { + input[type="text", name="q", placeholder=tr(ri.lang, "search.placeholder"), value=&query]; + input[type="submit", value="Search"]; + } + } + @if !items.is_empty() { + ul.nl.grid { @for nku in *items { + li { @NodeCard { ri, nku } } + }} + @if let Some(cont) = cont { + a.next_page[href=u_items_cont(cont)] { button { "Show more" } } + } + } + } +} -- cgit v1.3