yggdrasil/components/
mascot.rs1use leptos::prelude::*;
4
5#[derive(Clone, Copy, PartialEq, Eq)]
7pub enum Mascot {
8 Wave,
9 Panic,
10 Cry,
11 Hearts,
12 Sit,
13 Sleepy,
14 Doze,
15 Blissful,
16 Peace,
17 Curious,
18 Pout,
19}
20
21impl Mascot {
22 pub const fn src(self) -> &'static str {
23 match self {
24 Mascot::Wave => "/images/mascot/wave.webp",
25 Mascot::Panic => "/images/mascot/panic.webp",
26 Mascot::Cry => "/images/mascot/cry.webp",
27 Mascot::Hearts => "/images/mascot/hearts.webp",
28 Mascot::Sit => "/images/mascot/sit.webp",
29 Mascot::Sleepy => "/images/mascot/sleepy.webp",
30 Mascot::Doze => "/images/mascot/doze.webp",
31 Mascot::Blissful => "/images/mascot/blissful.webp",
32 Mascot::Peace => "/images/mascot/peace.webp",
33 Mascot::Curious => "/images/mascot/curious.webp",
34 Mascot::Pout => "/images/mascot/pout.webp",
35 }
36 }
37
38 pub fn img(self, class: &'static str) -> impl IntoView {
40 view! {
41 <img class=class src=self.src() alt="" aria-hidden="true"
42 width="256" height="256" decoding="async" loading="lazy"/>
43 }
44 }
45}