/*
    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!(Items<'_>, |x| tr(x.ri.lang, "items"));

markup::define! {
    Items<'a>(ri: &'a RenderInfo<'a>, items: &'a [Nku<'a>], cont: Option<String>) {
        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" } }
        }
    }
}
