-
+ if let Some(on) = on {
+ switch(on: on, label: label.as_str())
+ } else {
+
+ }
if let Some(cancel) = &cancel {
"Cancel"
}
@@ -465,6 +472,22 @@ pub(crate) async fn change_form<'a>(
})
}
+/// A switch named `label`, showing whether its setting is `on`: a button the
+/// stylesheet draws as a sliding toggle, which posts its form, or with
+/// `disabled`, only shows the setting to whom cannot change it.
+#[component]
+pub(crate) async fn switch<'a>(
+ on: bool,
+ label: &'a str,
+ #[default] disabled: bool,
+) -> Result
{
+ Ok(view! {
+
+ })
+}
+
/// A passkey ceremony the passkey script runs before posting a [`passkey_form`],
/// named by the form's marker.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
diff --git a/crates/ui/src/settings/notifications.rs b/crates/ui/src/settings/notifications.rs
index 1081aa36c..e0ddfcf31 100644
--- a/crates/ui/src/settings/notifications.rs
+++ b/crates/ui/src/settings/notifications.rs
@@ -3,7 +3,7 @@
use super::{Audience, HistoryRow, Holdings, timeline::report_form};
use crate::{
- form::{Checkbox, Precision, Query, change_form, open, time},
+ form::{Checkbox, Precision, Query, change_form, open, switch, time},
icons::{Icon, icon},
layout::{announcement_text, dialog, page_head},
};
@@ -232,14 +232,9 @@ async fn email_preferences<'a>(page: InboxPage<'a>) -> Result {