use leptos::prelude::*;
use super::animated_icon_registry::get_animated_icon_elements;
use super::animated_icon_type::AnimatedIconType;
use super::css_registry::get_icon_css;
use super::svg_icon::SvgIcon;
use crate::leptos::static_svg_element;
#[component]
pub fn AnimatedIcon(
icon: AnimatedIconType,
#[prop(into, optional)]
class: Signal<String>,
) -> impl IntoView {
let elements = get_animated_icon_elements(icon).unwrap_or(&[]);
let icon_css = get_icon_css(icon);
view! {
{if let Some(css) = icon_css { view! { <style>{css}</style> }.into_any() } else { view! {}.into_any() }}
<SvgIcon class=class data_name=icon.component_name().to_string()>
<title>{format!("Rust UI Animated Icons - {}", icon.component_name())}</title>
{elements.iter().map(|element| { element.to_leptos_view() }).collect::<Vec<_>>()}
</SvgIcon>
}
}