All checks were successful
actionlint check / actionlint check (pull_request) Successful in 7s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 3m44s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 3m46s
GitLeaks check / GitLeaks check (pull_request) Successful in 1m45s
Prettier check / Prettier check (pull_request) Successful in 2m1s
markdownlint check / markdownlint check (pull_request) Successful in 2m4s
htmlhint check / htmlhint check (pull_request) Successful in 2m6s
ShellCheck check / ShellCheck check (pull_request) Successful in 1m15s
yamllint check / yamllint check (pull_request) Successful in 1m11s
Stylelint check / Stylelint check (pull_request) Successful in 1m13s
Rust check / Rust check (pull_request) Successful in 22m46s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 19s
hadolint check / hadolint check (pull_request) Successful in 25s
checkov check / checkov check (pull_request) Successful in 56s
68 lines
2.4 KiB
Rust
68 lines
2.4 KiB
Rust
use crate::components::select_button::SelectButton;
|
|
use crate::models::category::Category;
|
|
use dioxus::core_macro::rsx;
|
|
use dioxus::dioxus_core::Element;
|
|
use dioxus::prelude::*;
|
|
use dioxus_free_icons::icons::fa_regular_icons::FaLightbulb;
|
|
use dioxus_free_icons::icons::fa_solid_icons::{
|
|
FaCalendarDays, FaHourglassHalf, FaInbox, FaSignsPost, FaWater,
|
|
};
|
|
|
|
#[component]
|
|
pub(crate) fn CategoryInput(
|
|
selected_category: Signal<Category>,
|
|
class: Option<&'static str>,
|
|
) -> Element {
|
|
rsx! {
|
|
div {
|
|
class: format!("grid grid-cols-3 gap-3 {}", class.unwrap_or("")),
|
|
SelectButton {
|
|
icon: FaLightbulb,
|
|
is_selected: matches!(selected_category(), Category::SomedayMaybe),
|
|
on_select: move |()| {
|
|
selected_category.set(Category::SomedayMaybe);
|
|
}
|
|
}
|
|
SelectButton {
|
|
icon: FaWater,
|
|
is_selected: matches!(selected_category(), Category::LongTerm),
|
|
on_select: move |()| {
|
|
selected_category.set(Category::LongTerm);
|
|
}
|
|
}
|
|
SelectButton {
|
|
icon: FaHourglassHalf,
|
|
is_selected: matches!(selected_category(), Category::WaitingFor(_)),
|
|
on_select: move |()| {
|
|
selected_category.set(Category::WaitingFor(String::new()));
|
|
}
|
|
}
|
|
SelectButton {
|
|
icon: FaSignsPost,
|
|
is_selected: matches!(selected_category(), Category::NextSteps),
|
|
on_select: move |()| {
|
|
selected_category.set(Category::NextSteps);
|
|
}
|
|
}
|
|
SelectButton {
|
|
icon: FaCalendarDays,
|
|
is_selected: matches!(selected_category(), Category::Calendar { .. }),
|
|
on_select: move |()| {
|
|
selected_category.set(Category::Calendar {
|
|
date: chrono::Local::now().date_naive(),
|
|
reoccurrence: None,
|
|
time: None,
|
|
});
|
|
}
|
|
}
|
|
SelectButton {
|
|
icon: FaInbox,
|
|
is_selected: matches!(selected_category(), Category::Inbox),
|
|
on_select: move |()| {
|
|
selected_category.set(Category::Inbox);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|