Skip to content

Commit

Permalink
update demo
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoburniske committed Apr 2, 2024
1 parent 0b475f8 commit 5741e96
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 31 deletions.
1 change: 0 additions & 1 deletion example/demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ copy_dir = "0.1.3"
leptos_meta = { version = "0.6.9", features = ["csr"] }
leptos_router = { version = "0.6.9", features = ["csr"] }
log = "0.4.20"
leptos_hotkeys = { git = "https://github.com/gaucho-labs/leptos-hotkeys", features = ["csr"]}

tailwind_fuse = { path = "../../fuse", features = ["variant"]}
leptos_theme = "0.1.2"
Expand Down
1 change: 1 addition & 0 deletions example/demo/dist/demo-aa2b231c719fd2ea.js

Large diffs are not rendered by default.

Binary file added example/demo/dist/demo-aa2b231c719fd2ea_bg.wasm
Binary file not shown.
1 change: 0 additions & 1 deletion example/demo/dist/demo-edd35c338c715942.js

This file was deleted.

Binary file removed example/demo/dist/demo-edd35c338c715942_bg.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion example/demo/dist/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang=en><meta charset=utf-8><meta content="width=device-width,initial-scale=1.0" name=viewport><title>tailwind fuse</title><script type=module>import a,*as b from"/demo-edd35c338c715942.js";a(`/demo-edd35c338c715942_bg.wasm`);window.wasmBindings=b</script><link href=/output-d283109e20e0c6f6.css integrity=sha384-YocR6_kxvlMOBvUA56T1JbsJ6c97idYdnPA_fxs-Hc0pSQezHsF6-q8mYhRoGRnV rel=stylesheet><link href=https://fonts.googleapis.com rel=preconnect><link crossorigin href=https://fonts.gstatic.com rel=preconnect><link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;800&family=Roboto+Mono&display=swap" rel=stylesheet><link as=fetch crossorigin href=/demo-edd35c338c715942_bg.wasm integrity=sha384-XkprjHhyXBmXoDL2zi6vuvaB2R82fmcaASGvIKuBwM3PqDzUfvgnYp5Mwl8-N117 rel=preload type=application/wasm><link crossorigin href=/demo-edd35c338c715942.js integrity=sha384-88nD99yrcaxjJbcdsx84Gm1LjO904tiD_QLue2ihV1hpyFS-qq5EHf2CM83gbgJN rel=modulepreload></head><body></body></html>
<!doctype html><html lang=en><meta charset=utf-8><meta content="width=device-width,initial-scale=1.0" name=viewport><title>tailwind fuse</title><script type=module>import a,*as b from"/demo-aa2b231c719fd2ea.js";a(`/demo-aa2b231c719fd2ea_bg.wasm`);window.wasmBindings=b</script><link href=/output-849e2261d228e02e.css integrity=sha384-leU8FwBNrlXBdYAZgZimMOZLWhX9o7Br1v-4JZzA4_BEvZIlVPX_eyATozcPxPHf rel=stylesheet><link href=https://fonts.googleapis.com rel=preconnect><link crossorigin href=https://fonts.gstatic.com rel=preconnect><link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;800&family=Roboto+Mono&display=swap" rel=stylesheet><link as=fetch crossorigin href=/demo-aa2b231c719fd2ea_bg.wasm integrity=sha384-AXHaOl9u2FTa1YD6d9WFWp2GRmIxud5km0h75m_iFuGiPVlWezIxHU9ay6-it0lM rel=preload type=application/wasm><link crossorigin href=/demo-aa2b231c719fd2ea.js integrity=sha384-PhEsuzQpjxJ_zLnFWtHTPzzYw78q54QvKdkY9SHBGGQ3kc9ehE42_WpgbU4m2mft rel=modulepreload></head><body></body></html>
1 change: 1 addition & 0 deletions example/demo/dist/output-849e2261d228e02e.css

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion example/demo/dist/output-d283109e20e0c6f6.css

This file was deleted.

37 changes: 14 additions & 23 deletions example/demo/src/app.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use leptos::*;
use leptos_hotkeys::prelude::*;
use leptos_meta::*;
use leptos_router::*;
use leptos_theme::*;
Expand All @@ -13,16 +12,11 @@ use tailwind_fuse::*;
#[component]
pub fn App() -> impl IntoView {
provide_meta_context();
let h_ref = provide_hotkeys_context(false, scopes!("home"));

use_hotkeys!(("ctrl+r") => move |_| {
window().location().set_href("https://github.com/gaucho-labs").expect("Failed to navigate");
});

view! {
<Stylesheet id="leptos" href="/pkg/demo.css"/>
<script>{include_str!("prism.js")}</script>
<main _ref=h_ref>
<main>
<ThemeProvider>
<Router>
<Routes>
Expand All @@ -39,14 +33,6 @@ pub fn App() -> impl IntoView {
fn HomePage() -> impl IntoView {
let toggle_default = create_rw_signal(false);

use_hotkeys!(("b", "home") => move |_| {
if toggle_default.get() {
toggle_default.set(false);
} else {
toggle_default.set(true);
}
});

let buttons = vec![
(
"Button sizes",
Expand Down Expand Up @@ -74,6 +60,19 @@ fn HomePage() -> impl IntoView {
}
.into_view(),
),
(
"Conditionally change the button variant",
view! {
<Button
variant= Signal::derive(move || if toggle_default.get() { ButtonVariant::Default} else { ButtonVariant::Secondary})
on:click=move |_| {
toggle_default.set(!toggle_default.get());
}
>
Click to change variant
</Button>
},
),
(
"Badge variants",
view! {
Expand All @@ -86,14 +85,6 @@ fn HomePage() -> impl IntoView {
}
.into_view(),
),
(
"Conditionally change the button variant",
view! {
<Button variant= Signal::derive(move || if toggle_default.get() { ButtonVariant::Default} else { ButtonVariant::Secondary})>
Press B to change variant
</Button>
},
),
];

view! {
Expand Down
2 changes: 1 addition & 1 deletion example/demo/src/component/badge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub struct BadgeClass {
pub variant: BadgeVariant,
}

#[derive(TwVariant, Clone, Copy)]
#[derive(TwVariant)]
pub enum BadgeVariant {
#[tw(
default,
Expand Down
4 changes: 2 additions & 2 deletions example/demo/src/component/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct ButtonClass {
pub size: ButtonSize,
}

#[derive(TwVariant, Clone, Copy)]
#[derive(TwVariant)]
pub enum ButtonVariant {
#[tw(
default,
Expand All @@ -54,7 +54,7 @@ pub enum ButtonVariant {
Link,
}

#[derive(TwVariant, Clone, Copy)]
#[derive(TwVariant)]
pub enum ButtonSize {
#[tw(default, class = "h-9 px-4 py-2")]
Default,
Expand Down
2 changes: 1 addition & 1 deletion example/demo/style/output.css

Large diffs are not rendered by default.

0 comments on commit 5741e96

Please sign in to comment.