mirror of
https://github.com/adoyle0/thaw.git
synced 2025-01-22 22:09:22 -05:00
fix: Icon attr
This commit is contained in:
parent
f33c012364
commit
8b122d0986
13 changed files with 36 additions and 39 deletions
|
@ -50,7 +50,7 @@ fn TheRouter(is_routing: RwSignal<bool>) -> impl IntoView {
|
|||
<Route path=(StaticSegment("development"), StaticSegment("components")) view=DevelopmentComponentsMdPage/>
|
||||
</ParentRoute>
|
||||
<ParentRoute path=StaticSegment("components") view=ComponentsPage>
|
||||
|
||||
|
||||
// // <Route path="/tabbar" view=TabbarPage/>
|
||||
// // <Route path="/nav-bar" view=NavBarPage/>
|
||||
// // <Route path="/toast" view=ToastPage/>
|
||||
|
|
|
@ -24,9 +24,7 @@ pub fn Demo(demo_code: DemoCode, #[prop(optional)] children: Option<Children>) -
|
|||
} else {
|
||||
css_vars.push_str("--demo-color: #00000060;");
|
||||
css_vars.push_str("--demo-color-hover: #000000e0;");
|
||||
css_vars.push_str(&format!(
|
||||
"--demo-border-color: var(--colorNeutralStroke2);",
|
||||
));
|
||||
css_vars.push_str(&format!("--demo-border-color: var(--colorNeutralStroke2);",));
|
||||
css_vars.push_str("--demo-background-color: #f9fafb;");
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::AccordionInjection;
|
||||
use leptos::{prelude::*, html};
|
||||
use leptos::{html, prelude::*};
|
||||
use thaw_components::CSSTransition;
|
||||
use thaw_utils::{mount_style, update, with, StoredMaybeSignal};
|
||||
|
||||
|
|
|
@ -7,4 +7,4 @@ pub fn DialogBody(children: Children) -> impl IntoView {
|
|||
{children()}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,4 +7,4 @@ pub fn DialogContent(children: Children) -> impl IntoView {
|
|||
{children()}
|
||||
</h2>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,4 +7,4 @@ pub fn DialogTitle(children: Children) -> impl IntoView {
|
|||
{children()}
|
||||
</h2>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,4 +7,4 @@ pub fn DrawerHeader(children: Children) -> impl IntoView {
|
|||
{children()}
|
||||
</header>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ pub fn Icon(
|
|||
let svg = view! {
|
||||
<svg
|
||||
class=class_list!["thaw-icon", class.map(|c| move || c.get())]
|
||||
style=move || take_signal(icon_style)
|
||||
style=move || take_signal(icon_style).unwrap_or_default()
|
||||
x=move || take(icon_x)
|
||||
y=move || take(icon_y)
|
||||
width=move || take_signal(icon_width)
|
||||
|
@ -102,18 +102,15 @@ pub fn Icon(
|
|||
svg.inner_html(move || take(icon_data))
|
||||
}
|
||||
|
||||
fn take_signal(signal: RwSignal<Option<MaybeSignal<String>>>) -> String {
|
||||
fn take_signal(signal: RwSignal<Option<MaybeSignal<String>>>) -> Option<String> {
|
||||
signal.with(|s| match s {
|
||||
Some(MaybeSignal::Static(value)) => value.clone(),
|
||||
Some(MaybeSignal::Dynamic(signal)) => signal.get(),
|
||||
_ => String::new(),
|
||||
Some(MaybeSignal::Static(value)) => Some(value.clone()),
|
||||
Some(MaybeSignal::Dynamic(signal)) => Some(signal.get()),
|
||||
_ => None,
|
||||
})
|
||||
}
|
||||
|
||||
fn take(signal: RwSignal<Option<String>>) -> String {
|
||||
fn take(signal: RwSignal<Option<String>>) -> Option<String> {
|
||||
signal.track();
|
||||
signal
|
||||
.try_update_untracked(|value| value.take())
|
||||
.flatten()
|
||||
.unwrap_or_default()
|
||||
signal.try_update_untracked(|value| value.take()).flatten()
|
||||
}
|
||||
|
|
|
@ -107,8 +107,8 @@ impl SpaceJustify {
|
|||
mod test {
|
||||
#[test]
|
||||
fn main() {
|
||||
use leptos::prelude::*;
|
||||
use super::Space;
|
||||
use leptos::prelude::*;
|
||||
|
||||
view! {
|
||||
<Space>
|
||||
|
@ -117,4 +117,4 @@ mod test {
|
|||
</Space>
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ pub fn Toaster(
|
|||
Effect::new(move |_| {
|
||||
for view in receiver.try_recv() {
|
||||
// toast_list.update(move |list| {
|
||||
// list.push(view.0);
|
||||
// list.push(view.0);
|
||||
// });
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use std::cell::Cell;
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
// use cfg_if::cfg_if;
|
||||
use leptos::prelude::*;
|
||||
|
||||
/// https://github.com/solidjs/solid/blob/main/packages/solid/web/src/index.ts#L56
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
use leptos::{
|
||||
logging::debug_warn,
|
||||
reactive_graph::{
|
||||
effect::RenderEffect,
|
||||
signal::RwSignal,
|
||||
traits::{Get, GetUntracked, Update},
|
||||
},
|
||||
};
|
||||
use std::cell::Cell;
|
||||
|
||||
pub struct ComponentRef<T: 'static>(RwSignal<Option<T>>);
|
||||
|
||||
|
@ -58,17 +56,17 @@ impl<T> ComponentRef<T> {
|
|||
});
|
||||
}
|
||||
|
||||
pub fn on_load<F>(self, f: F)
|
||||
where
|
||||
T: Clone,
|
||||
F: FnOnce(T) + 'static,
|
||||
{
|
||||
let f = Cell::new(Some(f));
|
||||
// pub fn on_load<F>(self, f: F)
|
||||
// where
|
||||
// T: Clone,
|
||||
// F: FnOnce(T) + 'static,
|
||||
// {
|
||||
// let f = Cell::new(Some(f));
|
||||
|
||||
RenderEffect::new(move |_| {
|
||||
if let Some(comp) = self.get() {
|
||||
f.take().unwrap()(comp);
|
||||
}
|
||||
});
|
||||
}
|
||||
// RenderEffect::new(move |_| {
|
||||
// if let Some(comp) = self.get() {
|
||||
// f.take().unwrap()(comp);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
use leptos::reactive_graph::{effect::Effect, signal::RwSignal, traits::{Dispose, With}, untrack};
|
||||
use leptos::reactive_graph::{
|
||||
effect::Effect,
|
||||
signal::RwSignal,
|
||||
traits::{Dispose, With},
|
||||
untrack,
|
||||
};
|
||||
|
||||
pub trait SignalWatch {
|
||||
type Value;
|
||||
|
|
Loading…
Add table
Reference in a new issue