{
let themes = vec!["light", "dark", "cupcake", "dracula", "cyberpunk", "emerald", "luxury", "nord"];
themes.into_iter().map(|theme| {
@@ -42,11 +57,8 @@ pub fn StatusBar() -> impl IntoView {
let doc = web_sys::window().unwrap().document().unwrap();
let _ = doc.document_element().unwrap().set_attribute("data-theme", theme);
- // Update theme-color meta tag to match new theme
if let Some(meta) = doc.query_selector("meta[name='theme-color']").unwrap() {
let window = web_sys::window().unwrap();
- // Force a style recalc by reading a property or just wait for next tick?
- // Usually get_computed_style forces it.
if let Ok(Some(style)) = window.get_computed_style(&doc.body().unwrap()) {
if let Ok(color) = style.get_property_value("background-color") {
let _ = meta.set_attribute("content", &color);
@@ -54,12 +66,7 @@ pub fn StatusBar() -> impl IntoView {
}
}
- // Close the dropdown by blurring the active element
- if let Some(active) = doc.active_element() {
- if let Ok(html_element) = active.dyn_into::() {
- let _ = html_element.blur();
- }
- }
+ set_theme_open.set(false);
}
>
{theme}
@@ -68,7 +75,8 @@ pub fn StatusBar() -> impl IntoView {
}
}).collect::>()
}
-