Skip to content

Commit

Permalink
Update Label to Leptos v0.7 (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielleHuisman authored Jan 3, 2025
1 parent 00985c5 commit e0ced4e
Show file tree
Hide file tree
Showing 16 changed files with 525 additions and 418 deletions.
78 changes: 78 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@
# "stories/*",
# ]
members = [
"book-examples/dioxus/*",
"book-examples/yew/*",
"book-examples/*/*",
"packages/colors",
"packages/icons/dioxus",
"packages/icons/yew",
"packages/primitives/leptos/id",
"packages/primitives/leptos/label",
"packages/primitives/yew/*",
"packages/themes/yew",
"scripts",
"stories/dioxus",
"stories/yew",
"stories/*",
]
resolver = "2"

Expand Down
5 changes: 3 additions & 2 deletions book-examples/leptos/icons/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ console_error_panic_hook.workspace = true
console_log.workspace = true
leptos = { workspace = true, features = ["csr"] }
log.workspace = true
radix-leptos-icons = { path = "../../../packages/icons/leptos", optional = true }
# radix-leptos-icons = { path = "../../../packages/icons/leptos", optional = true }

[features]
default = []
icons = ["dep:radix-leptos-icons"]
icons = []
# icons = ["dep:radix-leptos-icons"]
18 changes: 9 additions & 9 deletions book-examples/leptos/icons/src/app.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
use leptos::*;
use leptos::prelude::*;

#[component]
pub fn App() -> impl IntoView {
#[allow(unused_mut)]
let mut views: Vec<View> = vec![];
let mut views: Vec<AnyView> = vec![];

#[cfg(feature = "icons")]
{
use crate::icons::IconsDemo;
views.push(view! {
<IconsDemo />
});
}
// #[cfg(feature = "icons")]
// {
// use crate::icons::IconsDemo;
// views.push(view! {
// <IconsDemo />
// });
// }

view! {
<div class="w-full h-full flex justify-center items-start">
Expand Down
8 changes: 5 additions & 3 deletions book-examples/leptos/icons/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
mod app;

#[cfg(feature = "icons")]
mod icons;
// #[cfg(feature = "icons")]
// mod icons;

use leptos::prelude::*;

use crate::app::App;

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

leptos::mount_to_body(App);
mount_to_body(App);
}
37 changes: 22 additions & 15 deletions book-examples/leptos/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ console_error_panic_hook.workspace = true
console_log.workspace = true
leptos = { workspace = true, features = ["csr"] }
log.workspace = true
radix-leptos-aspect-ratio = { path = "../../../packages/primitives/leptos/aspect-ratio", optional = true }
radix-leptos-avatar = { path = "../../../packages/primitives/leptos/avatar", optional = true }
radix-leptos-checkbox = { path = "../../../packages/primitives/leptos/checkbox", optional = true }
radix-leptos-icons = { path = "../../../packages/icons/leptos", optional = true }
# radix-leptos-aspect-ratio = { path = "../../../packages/primitives/leptos/aspect-ratio", optional = true }
# radix-leptos-avatar = { path = "../../../packages/primitives/leptos/avatar", optional = true }
# radix-leptos-checkbox = { path = "../../../packages/primitives/leptos/checkbox", optional = true }
# radix-leptos-icons = { path = "../../../packages/icons/leptos", optional = true }
radix-leptos-label = { path = "../../../packages/primitives/leptos/label", optional = true }
radix-leptos-progress = { path = "../../../packages/primitives/leptos/progress", optional = true }
radix-leptos-separator = { path = "../../../packages/primitives/leptos/separator", optional = true }
radix-leptos-switch = { path = "../../../packages/primitives/leptos/switch", optional = true }
radix-leptos-toggle = { path = "../../../packages/primitives/leptos/toggle", optional = true }
# radix-leptos-progress = { path = "../../../packages/primitives/leptos/progress", optional = true }
# radix-leptos-separator = { path = "../../../packages/primitives/leptos/separator", optional = true }
# radix-leptos-switch = { path = "../../../packages/primitives/leptos/switch", optional = true }
# radix-leptos-toggle = { path = "../../../packages/primitives/leptos/toggle", optional = true }

[features]
default = [
Expand All @@ -35,11 +35,18 @@ default = [
"switch",
"toggle",
]
aspect-ratio = ["dep:radix-leptos-aspect-ratio"]
avatar = ["dep:radix-leptos-avatar"]
checkbox = ["dep:radix-leptos-checkbox", "dep:radix-leptos-icons"]
aspect-ratio = []
avatar = []
checkbox = []
label = ["dep:radix-leptos-label"]
progress = ["dep:radix-leptos-progress"]
separator = ["dep:radix-leptos-separator"]
switch = ["dep:radix-leptos-switch"]
toggle = ["dep:radix-leptos-toggle", "dep:radix-leptos-icons"]
progress = []
separator = []
switch = []
toggle = []
# aspect-ratio = ["dep:radix-leptos-aspect-ratio"]
# avatar = ["dep:radix-leptos-avatar"]
# checkbox = ["dep:radix-leptos-checkbox", "dep:radix-leptos-icons"]
# progress = ["dep:radix-leptos-progress"]
# separator = ["dep:radix-leptos-separator"]
# switch = ["dep:radix-leptos-switch"]
# toggle = ["dep:radix-leptos-toggle", "dep:radix-leptos-icons"]
111 changes: 57 additions & 54 deletions book-examples/leptos/primitives/src/app.rs
Original file line number Diff line number Diff line change
@@ -1,65 +1,68 @@
use leptos::*;
use leptos::prelude::*;

#[component]
pub fn App() -> impl IntoView {
let mut views: Vec<View> = vec![];
let mut views: Vec<AnyView> = vec![];

#[cfg(feature = "aspect-ratio")]
{
use crate::aspect_ratio::AspectRatioDemo;
views.push(view! {
<AspectRatioDemo />
});
}
#[cfg(feature = "avatar")]
{
use crate::avatar::AvatarDemo;
views.push(view! {
<AvatarDemo />
});
}
#[cfg(feature = "checkbox")]
{
use crate::checkbox::CheckboxDemo;
views.push(view! {
<CheckboxDemo />
});
}
// #[cfg(feature = "aspect-ratio")]
// {
// use crate::aspect_ratio::AspectRatioDemo;
// views.push(view! {
// <AspectRatioDemo />
// });
// }
// #[cfg(feature = "avatar")]
// {
// use crate::avatar::AvatarDemo;
// views.push(view! {
// <AvatarDemo />
// });
// }
// #[cfg(feature = "checkbox")]
// {
// use crate::checkbox::CheckboxDemo;
// views.push(view! {
// <CheckboxDemo />
// });
// }
#[cfg(feature = "label")]
{
use crate::label::LabelDemo;
views.push(view! {
<LabelDemo />
});
}
#[cfg(feature = "progress")]
{
use crate::progress::ProgressDemo;
views.push(view! {
<ProgressDemo />
});
}
#[cfg(feature = "separator")]
{
use crate::separator::SeparatorDemo;
views.push(view! {
<SeparatorDemo />
});
}
#[cfg(feature = "switch")]
{
use crate::switch::SwitchDemo;
views.push(view! {
<SwitchDemo />
});
}
#[cfg(feature = "toggle")]
{
use crate::toggle::ToggleDemo;
views.push(view! {
<ToggleDemo />
});
views.push(
view! {
<LabelDemo />
}
.into_any(),
);
}
// #[cfg(feature = "progress")]
// {
// use crate::progress::ProgressDemo;
// views.push(view! {
// <ProgressDemo />
// });
// }
// #[cfg(feature = "separator")]
// {
// use crate::separator::SeparatorDemo;
// views.push(view! {
// <SeparatorDemo />
// });
// }
// #[cfg(feature = "switch")]
// {
// use crate::switch::SwitchDemo;
// views.push(view! {
// <SwitchDemo />
// });
// }
// #[cfg(feature = "toggle")]
// {
// use crate::toggle::ToggleDemo;
// views.push(view! {
// <ToggleDemo />
// });
// }

view! {
<div class="w-full h-full flex justify-center items-start">
Expand Down
4 changes: 2 additions & 2 deletions book-examples/leptos/primitives/src/label.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use leptos::*;
use leptos::prelude::*;
use radix_leptos_label::*;

#[component]
pub fn LabelDemo() -> impl IntoView {
view! {
<div class="flex flex-wrap items-center gap-[15px] px-5">
<Label attr:class="text-[15px] font-medium leading-[35px] text-white" attr:for="firstName">
<Label attr:class="text-[15px] font-medium leading-[35px] text-white" attr:r#for="firstName">
First name
</Label>
<input
Expand Down
Loading

0 comments on commit e0ced4e

Please sign in to comment.