feat(components): add the EditQuote component

This commit is contained in:
Reed Krantz
2026-01-12 19:33:20 -06:00
parent 34ccb376fd
commit 10c21f2a3c
2 changed files with 41 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
use crate::components::{
date_picker::{DatePicker, DatePickerInput},
Input,
};
use dioxus::prelude::*;
use time::{macros::offset, OffsetDateTime};
#[component]
pub fn EditQuote() -> Element {
let mut quote = use_signal(String::new);
let mut source = use_signal(String::new);
let mut date = use_signal(|| {
Some(
OffsetDateTime::now_local()
.unwrap_or_else(|_| OffsetDateTime::now_utc().to_offset(offset!(-6)))
.date(),
)
});
rsx! {
Input {
oninput: move |e: FormEvent| quote.set(e.value()),
placeholder: "Enter the quote",
value: quote,
}
Input {
oninput: move |e: FormEvent| source.set(e.value()),
placeholder: "Enter who said this",
value: source,
}
DatePicker {
selected_date: date(),
on_value_change: move |v| date.set(v),
DatePickerInput {}
}
}
}

View File

@@ -11,6 +11,9 @@ pub use input::Input;
mod echo; mod echo;
pub use echo::Echo; pub use echo::Echo;
mod edit_quote;
pub use edit_quote::EditQuote;
pub mod calendar; pub mod calendar;
pub mod date_picker; pub mod date_picker;
pub mod popover; pub mod popover;