Skip to content
use maud::{Markup, html};

pub fn heart() -> Markup {
    html! {
        svg xmlns="http://www.w3.org/2000/svg" class="size-6 shrink-0" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" {
            path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" {}
        }
    }
}

pub fn cat() -> Markup {
    html! {
        svg xmlns="http://www.w3.org/2000/svg" class="size-6 shrink-0" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" {
            path d="M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3.1-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.26 6.5 2.26.65-.17 1.33-.26 2-.26z" {}
            path d="M9 13v.01" {}
            path d="M15 13v.01" {}
            path d="M10 17c.5.5 1.5 1 2 1s1.5-.5 2-1" {}
        }
    }
}

pub fn emergency() -> Markup {
    html! {
        svg xmlns="http://www.w3.org/2000/svg" class="size-6 shrink-0" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" {
            path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z" {}
            path d="M12 2v4" {}
            path d="m4.93 4.93 2.83 2.83" {}
            path d="m19.07 4.93-2.83 2.83" {}
        }
    }
}

pub fn terminal() -> Markup {
    html! {
        svg xmlns="http://www.w3.org/2000/svg" class="size-6 shrink-0" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" {
            polyline points="4 17 10 11 4 5" {}
            line x1="12" y1="19" x2="20" y2="19" {}
        }
    }
}

pub fn apple() -> Markup {
    html! {
        svg xmlns="http://www.w3.org/2000/svg" class="size-6 shrink-0" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" {
            path d="M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M15.97 6.38c.62-.75 1.04-1.8 0.93-2.85-.9.04-1.99.6-2.63 1.35-.57.66-.99 1.72-.88 2.74 1.01.08 2.03-.51 2.58-1.24z" {}
        }
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_icons_render_svg() {
        assert!(heart().into_string().contains("<svg"));
        assert!(cat().into_string().contains("<svg"));
        assert!(emergency().into_string().contains("<svg"));
        assert!(terminal().into_string().contains("<svg"));
        assert!(apple().into_string().contains("<svg"));
    }
}