Major early updates
This commit is contained in:
26
frontend/src/components/status_badge.rs
Normal file
26
frontend/src/components/status_badge.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
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",
|
||||
"downloading" => "badge badge-available",
|
||||
"cancelled" => "badge badge-pending",
|
||||
_ => "badge",
|
||||
};
|
||||
|
||||
html! {
|
||||
<span class={class}>{ &props.status }</span>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user