Skip to content

Commit

Permalink
Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
Oyelowo committed Jan 17, 2025
1 parent bccccf8 commit fa8d30b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 27 deletions.
23 changes: 3 additions & 20 deletions examples/leptos-demo/src/app.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,11 @@
use leptos::*;
use leptos_meta::*;
use leptos_router::*;
use leptos::prelude::*;
use twust::tw;

#[component]
pub fn App() -> impl IntoView {
provide_meta_context();

view! {
<Stylesheet id="leptos" href="/pkg/tailwind.css"/>
<Link rel="shortcut icon" type_="image/ico" href="/favicon.ico"/>
<Router>
<Routes>
<Route path="" view= move || view! { <Home/> }/>
</Routes>
</Router>
}
}

#[component]
fn Home() -> impl IntoView {
pub fn Home() -> impl IntoView {
// Try to break mistype any of the class name and see what happens.
// Daisyui classes are also ssupported via a feature flag
let x = tw!("my-5 mx-auto max-w-3xl text-center");
let _x = tw!("my-5 mx-auto max-w-3xl text-center");
view! {
<div class=tw!("my-5 mx-auto max-w-3xl text-center")>
<h2 class=tw!("p-6 text-4xl")>"Twust"</h2>
Expand Down
16 changes: 9 additions & 7 deletions examples/leptos-demo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ mod app;
use app::*;
use leptos::*;

use leptos_router::components::Router;

pub fn main() {
_ = console_log::init_with_level(log::Level::Debug);
console_error_panic_hook::set_once();

// logging::log!("csr mode - mounting to body");

mount_to_body(|| {
view! { <App /> }
});
leptos::mount::mount_to_body(|| {
view! {
<Router>
<Home />
</Router>
}
})
}

0 comments on commit fa8d30b

Please sign in to comment.