2023-06-10 03:19:00 +01:00
|
|
|
use leptos::*;
|
|
|
|
use leptos_use::docs::{demo_or_body, BooleanDisplay};
|
|
|
|
use leptos_use::use_media_query;
|
|
|
|
|
|
|
|
#[component]
|
2023-07-27 18:06:36 +01:00
|
|
|
fn Demo() -> impl IntoView {
|
|
|
|
let is_large_screen = use_media_query("(min-width: 1024px)");
|
|
|
|
let is_dark_preferred = use_media_query("(prefers-color-scheme: dark)");
|
2023-06-10 03:19:00 +01:00
|
|
|
|
2023-07-27 18:06:36 +01:00
|
|
|
view! { <p>"Is large screen: " <BooleanDisplay value=is_large_screen /></p>
|
2023-06-10 03:19:00 +01:00
|
|
|
<p>"Is dark preferred: " <BooleanDisplay value=is_dark_preferred /></p>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
_ = console_log::init_with_level(log::Level::Debug);
|
|
|
|
console_error_panic_hook::set_once();
|
|
|
|
|
2023-07-27 18:06:36 +01:00
|
|
|
mount_to(demo_or_body(), || {
|
|
|
|
view! { <Demo /> }
|
2023-06-10 03:19:00 +01:00
|
|
|
})
|
|
|
|
}
|