Files
web/frontend/src/components/status_badge.rs
2026-03-18 14:54:52 -04:00

28 lines
801 B
Rust

use yew::prelude::*;
#[derive(Properties, PartialEq)]
pub struct Props {
pub status: String,
}
#[function_component(StatusBadge)]
pub fn status_badge(props: &Props) -> Html {
let class = match props.status.to_lowercase().as_str() {
"wanted" => "badge badge-wanted",
"available" => "badge badge-available",
"downloaded" => "badge badge-downloaded",
"owned" => "badge badge-owned",
"pending" => "badge badge-pending",
"failed" => "badge badge-failed",
"completed" => "badge badge-completed",
"running" => "badge badge-available",
"downloading" => "badge badge-available",
"cancelled" => "badge badge-pending",
_ => "badge",
};
html! {
<span class={class}>{ &props.status }</span>
}
}