feat(item_list): move delete buttons next to item name

This commit is contained in:
ryan 2025-01-29 16:07:10 +03:00
parent 792b4daf04
commit 2d072f3303

View file

@ -497,7 +497,7 @@ pub fn ItemsList(
}; };
// List of properties to display as rows // List of properties to display as rows
let properties = vec!["Name", "Description", "Actions"]; let properties = vec!["Name", "Description"];
view! { view! {
<div> <div>
@ -508,7 +508,10 @@ pub fn ItemsList(
<th>{ "Property" }</th> <th>{ "Property" }</th>
{move || items.get().iter().enumerate().map(|(index, item)| { {move || items.get().iter().enumerate().map(|(index, item)| {
view! { view! {
<th>{ item.name.clone() }</th> <th>
{ item.name.clone() }
<button on:click=move |_| remove_item(index)>{ "Delete" }</button>
</th>
} }
}).collect::<Vec<_>>()} }).collect::<Vec<_>>()}
</tr> </tr>
@ -644,9 +647,6 @@ pub fn ItemsList(
input_type=InputType::TextArea input_type=InputType::TextArea
/> />
}.into_view(), }.into_view(),
"Actions" => view! {
<button on:click=move |_| remove_item(index)>{ "Delete" }</button>
}.into_view(),
_ => view! { _ => view! {
{ "" } { "" }
}.into_view(), }.into_view(),
@ -665,7 +665,6 @@ pub fn ItemsList(
let property_clone = property.clone(); let property_clone = property.clone();
let property_label = property_labels.get().get(&property_clone).cloned().unwrap_or_else(|| property_clone.clone()); let property_label = property_labels.get().get(&property_clone).cloned().unwrap_or_else(|| property_clone.clone());
let property_clone_for_button = property_clone.clone(); let property_clone_for_button = property_clone.clone();
let property_clone_for_cells = property_clone.clone();
view! { view! {
<tr> <tr>
<td> <td>