Skip to content

Commit

Permalink
Change icon from cross to trash.
Browse files Browse the repository at this point in the history
  • Loading branch information
vaijira committed Nov 17, 2024
1 parent 2f9491d commit 321c873
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
css::TABLE_ROW,
data::{Aeat720Record, BrokerInformation},
utils::{
icons::{render_svg_delete_square_icon, render_svg_edit_icon, render_svg_save_icon},
icons::{render_svg_edit_icon, render_svg_save_icon, render_svg_trash_icon},
usize_to_date,
},
};
Expand Down Expand Up @@ -353,7 +353,7 @@ impl Table {


let delete_span = html!("span" => HtmlElement, {
.child(render_svg_delete_square_icon("red", "24"))
.child(render_svg_trash_icon("red", "24"))
.with_node!(_element => {
.event(clone!(this => move |_: events::Click| {
this.data.lock_mut().remove(index);
Expand Down
34 changes: 32 additions & 2 deletions src/utils/icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,36 @@ fn svg_icon_attrs(icon: DomBuilder<SvgElement>) -> DomBuilder<SvgElement> {
.attr("stroke-linejoin", "round")
}

pub fn render_svg_trash_icon(color: &str, size: &str) -> Dom {
svg!("svg", {
.attr("alt", "trash icon")
.attr("width", size)
.attr("height", size)
.attr("stroke", color)
.apply(svg_icon_attrs)
.children(&mut[
svg!("polyline", {
.attr("points", "3 6 5 6 21 6")
}),
svg!("path", {
.attr("d", "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2")
}),
svg!("line", {
.attr("x1", "10")
.attr("y1", "11")
.attr("x2", "10")
.attr("y2", "17")
}),
svg!("line", {
.attr("x1", "14")
.attr("y1", "11")
.attr("x2", "14")
.attr("y2", "17")
}),
])
})
}

pub fn render_svg_save_icon(color: &str, size: &str) -> Dom {
svg!("svg", {
.attr("alt", "save icon")
Expand Down Expand Up @@ -48,9 +78,9 @@ pub fn render_svg_edit_icon(color: &str, size: &str) -> Dom {
})
}

pub fn render_svg_delete_square_icon(color: &str, size: &str) -> Dom {
pub fn render_svg_cancel_icon(color: &str, size: &str) -> Dom {

Check warning on line 81 in src/utils/icons.rs

View workflow job for this annotation

GitHub Actions / Format & Clippy (1.80.1)

function `render_svg_cancel_icon` is never used

Check warning on line 81 in src/utils/icons.rs

View workflow job for this annotation

GitHub Actions / Unit Tests on 1.80.1

function `render_svg_cancel_icon` is never used

Check warning on line 81 in src/utils/icons.rs

View workflow job for this annotation

GitHub Actions / Unit Tests on 1.80.1

function `render_svg_cancel_icon` is never used
svg!("svg", {
.attr("alt", "delete icon")
.attr("alt", "cancel icon")
.attr("width", size)
.attr("height", size)
.attr("stroke", color)
Expand Down

1 comment on commit 321c873

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.