Skip to content

Commit

Permalink
use new api
Browse files Browse the repository at this point in the history
  • Loading branch information
rambip committed Nov 29, 2023
1 parent dbc236c commit 69c7fc9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 29 deletions.
42 changes: 21 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 14 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,21 @@ impl<'a> Context<'a, 'static> for &'a __MdProps {
r = r.on(ev::click, move |e| Callable::call(&c, e));
}
r = r.classes(attributes.classes.join(" "));
if let Some(i) = attributes.inner_html {
r = r.inner_html(i.to_string());
r.into_view()
}

fn el_span_with_inner_html(self, inner_html: String, attributes: ElementAttributes<Callback<MouseEvent>>) -> Self::View {
let mut r = view!{
<span inner_html=inner_html></span>
}.into_any();

if let Some(s) = attributes.style {
r = r.attr("style", s.to_string())
}
if let Some(c) = attributes.on_click {
r = r.on(ev::click, move |e| Callable::call(&c, e));
}
r = r.classes(attributes.classes.join(" "));
r.into_view()
}

Expand All @@ -132,9 +144,6 @@ impl<'a> Context<'a, 'static> for &'a __MdProps {
r = r.on(ev::click, move |e| Callable::call(&c, e));
}
r = r.classes(attributes.classes.join(" "));
if let Some(i) = attributes.inner_html {
r = r.inner_html(i.to_string());
}
r.into_view()
}

Expand Down Expand Up @@ -182,9 +191,6 @@ impl<'a> Context<'a, 'static> for &'a __MdProps {
r = r.on(ev::click, move |e| Callable::call(&c, e));
}
r = r.classes(attributes.classes.join(" "));
if let Some(i) = attributes.inner_html {
r = r.inner_html(i.to_string());
}
if let Some(s) = attributes.style {
r = r.attr("style", s.to_string())
}
Expand Down

0 comments on commit 69c7fc9

Please sign in to comment.