mirror of
https://github.com/adoyle0/thaw.git
synced 2025-02-02 08:34:15 -05:00
refactor: leptos_dom library
This commit is contained in:
parent
ed2501d2d2
commit
c6d7a77eaa
7 changed files with 33 additions and 13 deletions
|
@ -15,7 +15,6 @@ license = "MIT"
|
|||
[dependencies]
|
||||
leptos = { version = "0.5.0", features = ["csr"] }
|
||||
web-sys = { version = "0.3.62", features = ["DomRect"] }
|
||||
leptos_dom = { version = "0.5.0" }
|
||||
wasm-bindgen = "0.2.85"
|
||||
icondata = { version = "0.0.7", features = [
|
||||
"AiCloseOutlined",
|
||||
|
|
|
@ -1,15 +1,32 @@
|
|||
use crate::components::{Demo, DemoCode};
|
||||
use leptos::*;
|
||||
use melt_ui::*;
|
||||
use prisms::highlight_str;
|
||||
|
||||
#[component]
|
||||
pub fn ColorPickerPage() -> impl IntoView {
|
||||
let value = create_rw_signal(RGBA::default());
|
||||
|
||||
view! {
|
||||
<div style="width: 896px; margin: 0 auto;">
|
||||
<h1>"Color Picker"</h1>
|
||||
<Demo>
|
||||
<ColorPicker/>
|
||||
<DemoCode slot>""</DemoCode>
|
||||
<ColorPicker value/>
|
||||
<DemoCode
|
||||
slot
|
||||
html=highlight_str!(
|
||||
r#"
|
||||
let value = RGBA::default();
|
||||
|
||||
view! {
|
||||
<ColorPicker value/>
|
||||
}
|
||||
"#,
|
||||
"rust"
|
||||
)
|
||||
>
|
||||
""
|
||||
</DemoCode>
|
||||
</Demo>
|
||||
</div>
|
||||
}
|
||||
|
|
|
@ -10,17 +10,21 @@ pub fn InputPage() -> impl IntoView {
|
|||
<div style="width: 896px; margin: 0 auto;">
|
||||
<h1>"Input"</h1>
|
||||
<Demo>
|
||||
<Input value/>
|
||||
<Input value variant=InputVariant::PASSWORD/>
|
||||
<Space vertical=true>
|
||||
<Input value/>
|
||||
<Input value variant=InputVariant::PASSWORD/>
|
||||
</Space>
|
||||
<DemoCode
|
||||
slot
|
||||
html=highlight_str!(
|
||||
r#"
|
||||
let value = create_rw_signal(String::from("o"));
|
||||
let value = create_rw_signal(String::from("o"));
|
||||
|
||||
<Input value/>
|
||||
<Input value variant=InputVariant::PASSWORD />
|
||||
"#,
|
||||
view! {
|
||||
<Input value/>
|
||||
<Input value variant=InputVariant::PASSWORD />
|
||||
}
|
||||
"#,
|
||||
"rust"
|
||||
)
|
||||
>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use leptos::*;
|
||||
use crate::utils::mount_style::mount_style;
|
||||
use leptos::*;
|
||||
|
||||
#[component]
|
||||
pub fn Code(children: Children) -> impl IntoView {
|
||||
|
|
|
@ -2,8 +2,8 @@ mod color;
|
|||
|
||||
use crate::{mount_style, teleport::Teleport, utils::maybe_rw_signal::MaybeRwSignal};
|
||||
pub use color::*;
|
||||
use leptos::leptos_dom::helpers::WindowListenerHandle;
|
||||
use leptos::*;
|
||||
use leptos_dom::helpers::WindowListenerHandle;
|
||||
use wasm_bindgen::__rt::IntoJsResult;
|
||||
|
||||
#[component]
|
||||
|
|
|
@ -17,7 +17,7 @@ pub fn show_toast(options: ToastOptions) {
|
|||
|
||||
#[cfg(all(target_arch = "wasm32"))]
|
||||
{
|
||||
use leptos_dom::Mountable;
|
||||
use leptos::leptos_dom::Mountable;
|
||||
let node = node.get_mountable_node();
|
||||
parent.append_child(&node).unwrap();
|
||||
set_timeout(
|
||||
|
|
|
@ -15,7 +15,7 @@ pub fn Teleport(#[prop(optional)] to: Option<&'static str>, children: Children)
|
|||
|
||||
#[cfg(all(target_arch = "wasm32"))]
|
||||
{
|
||||
use leptos_dom::Mountable;
|
||||
use leptos::leptos_dom::Mountable;
|
||||
let node = children().into_view();
|
||||
let node = node.get_mountable_node();
|
||||
parent.append_child(&node).unwrap();
|
||||
|
|
Loading…
Add table
Reference in a new issue