feat(components): build item list component
This commit is contained in:
parent
6cbc98d76d
commit
02a888be57
|
@ -0,0 +1,23 @@
|
|||
use leptos::*;
|
||||
use crate::models::item::Item;
|
||||
|
||||
#[component]
|
||||
pub fn ItemsList(cx: Scope, items: Vec<Item>) -> impl IntoView {
|
||||
view! { cx,
|
||||
<div>
|
||||
<h2>{ "Items" }</h2>
|
||||
<ul>
|
||||
{items.iter().map(|item| view! { cx,
|
||||
<li>
|
||||
<strong>{ &item.name }</strong> - { &item.description }
|
||||
<ul>
|
||||
{item.tags.iter().map(|(key, value)| view! { cx,
|
||||
<li>{ key.clone() + ": " + value }</li>
|
||||
}).collect::<Vec<_>>()}
|
||||
</ul>
|
||||
</li>
|
||||
}).collect::<Vec<_>>()}
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue