impulse_ui_kit/
lib.rs

1//! UI Kit framework built on top of Leptos.
2//!
3//! Provides a simple `setup_app` function to launch your
4//! CSR (client-side rendered) application.
5
6#![allow(non_snake_case)]
7#![warn(missing_docs)]
8#![deny(warnings, clippy::todo, clippy::unimplemented)]
9
10pub mod router;
11pub mod utils;
12
13pub mod prelude;
14
15use leptos::prelude::*;
16
17/// Application entrypoint.
18///
19/// Just specify log level and needed view:
20///
21/// ```rust,ignore
22/// fn main() {
23///   setup_app(log::Level::Info, Box::new(move || view! { <App /> }.into_any()))
24/// }
25/// ```
26pub fn setup_app(#[allow(unused_variables)] log_level: log::Level, children: Children) {
27  console_error_panic_hook::set_once();
28  #[cfg(debug_assertions)]
29  console_log::init_with_level(log::Level::Debug).unwrap();
30  #[cfg(not(debug_assertions))]
31  console_log::init_with_level(log_level).unwrap();
32  leptos::mount::mount_to_body(move || view! { {children()} })
33}