mirror of
https://github.com/adoyle0/leptos-use.git
synced 2025-02-02 19:04:15 -05:00
36 lines
903 B
Rust
36 lines
903 B
Rust
|
use leptos::*;
|
||
|
use leptos_use::docs::demo_or_body;
|
||
|
use leptos_use::use_device_orientation;
|
||
|
|
||
|
#[component]
|
||
|
fn Demo() -> impl IntoView {
|
||
|
let orientation = use_device_orientation();
|
||
|
|
||
|
view! {
|
||
|
<pre>
|
||
|
{move || format!(
|
||
|
concat!(
|
||
|
"is_supported: {}\n",
|
||
|
"absolute: {}\n",
|
||
|
"alpha: {:?}\n",
|
||
|
"beta: {:?}\n",
|
||
|
"gamma: {:?}\n",
|
||
|
),
|
||
|
orientation.is_supported.get(),
|
||
|
orientation.absolute.get(),
|
||
|
orientation.alpha.get(),
|
||
|
orientation.beta.get(),
|
||
|
orientation.gamma.get(),
|
||
|
)}
|
||
|
</pre> }
|
||
|
}
|
||
|
|
||
|
fn main() {
|
||
|
_ = console_log::init_with_level(log::Level::Debug);
|
||
|
console_error_panic_hook::set_once();
|
||
|
|
||
|
mount_to(demo_or_body(), || {
|
||
|
view! { <Demo/> }
|
||
|
})
|
||
|
}
|