diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-03-11 05:00:47 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-03-11 05:00:47 +0100 |
| commit | f13f8b4cda8c64b4676ae564206a597ae8a1444e (patch) | |
| tree | 502042de20d299c581c87eaf8f652258a98b7f13 /ui/src/components | |
| parent | 89d9e1703b06ad6f84933e1399e70a9d055dfbe8 (diff) | |
| download | jellything-f13f8b4cda8c64b4676ae564206a597ae8a1444e.tar jellything-f13f8b4cda8c64b4676ae564206a597ae8a1444e.tar.bz2 jellything-f13f8b4cda8c64b4676ae564206a597ae8a1444e.tar.zst | |
restore old search ui
Diffstat (limited to 'ui/src/components')
| -rw-r--r-- | ui/src/components/mod.rs | 1 | ||||
| -rw-r--r-- | ui/src/components/search.rs | 31 |
2 files changed, 32 insertions, 0 deletions
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 <metamuffin.org> +*/ + +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<String>) { + .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" } } + } + } + } +} |