mirror of
https://github.com/adoyle0/thaw.git
synced 2025-02-02 08:34:15 -05:00
fix: Modal nightly (#119)
This commit is contained in:
parent
9216e5e2d2
commit
4779eb2d24
4 changed files with 37 additions and 4 deletions
24
.github/workflows/ci.yml
vendored
24
.github/workflows/ci.yml
vendored
|
@ -75,3 +75,27 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
cd ./examples/ssr_axum
|
cd ./examples/ssr_axum
|
||||||
cargo leptos build --release
|
cargo leptos build --release
|
||||||
|
nightly-cargo-leptos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup Rust
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: nightly
|
||||||
|
target: wasm32-unknown-unknown
|
||||||
|
override: true
|
||||||
|
- name: Install Trunk
|
||||||
|
uses: jetli/trunk-action@v0.4.0
|
||||||
|
with:
|
||||||
|
version: "latest"
|
||||||
|
- name: Install Cargo BInstall
|
||||||
|
uses: cargo-bins/cargo-binstall@main
|
||||||
|
- name: Install Cargo Leptos
|
||||||
|
run: cargo binstall cargo-leptos -y
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
cd ./examples/ssr_axum
|
||||||
|
cargo leptos build --release --features nightly
|
||||||
|
|
|
@ -44,13 +44,21 @@ view! {
|
||||||
let value = create_rw_signal(String::from("o"));
|
let value = create_rw_signal(String::from("o"));
|
||||||
let input_ref = create_component_ref::<InputRef>();
|
let input_ref = create_component_ref::<InputRef>();
|
||||||
|
|
||||||
|
let focus = Callback::new(move |_| {
|
||||||
|
input_ref.get_untracked().unwrap().focus()
|
||||||
|
});
|
||||||
|
|
||||||
|
let blur = Callback::new(move |_| {
|
||||||
|
input_ref.get_untracked().unwrap().blur()
|
||||||
|
});
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
<Space vertical=true>
|
<Space vertical=true>
|
||||||
<Space>
|
<Space>
|
||||||
<Button on_click=move |_| input_ref.get_untracked().unwrap().focus()>
|
<Button on_click=focus>
|
||||||
"Focus"
|
"Focus"
|
||||||
</Button>
|
</Button>
|
||||||
<Button on_click=move |_| input_ref.get_untracked().unwrap().blur()>
|
<Button on_click=blur>
|
||||||
"Blur"
|
"Blur"
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
|
|
|
@ -45,6 +45,7 @@ ssr = [
|
||||||
"dep:tracing",
|
"dep:tracing",
|
||||||
"demo/ssr",
|
"demo/ssr",
|
||||||
]
|
]
|
||||||
|
nightly = ["demo/nightly"]
|
||||||
|
|
||||||
# Defines a size-optimized profile for the WASM bundle in release mode
|
# Defines a size-optimized profile for the WASM bundle in release mode
|
||||||
[profile.wasm-release]
|
[profile.wasm-release]
|
||||||
|
|
|
@ -33,7 +33,7 @@ pub fn Modal(
|
||||||
let modal_ref = NodeRef::<html::Div>::new();
|
let modal_ref = NodeRef::<html::Div>::new();
|
||||||
|
|
||||||
let click_position = use_click_position();
|
let click_position = use_click_position();
|
||||||
let on_enter = move |_| {
|
let on_enter = Callback::new(move |_| {
|
||||||
let Some(position) = click_position.get_untracked() else {
|
let Some(position) = click_position.get_untracked() else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
@ -51,7 +51,7 @@ pub fn Modal(
|
||||||
let y = -(modal_el.offset_top() - position.1 - scroll_top);
|
let y = -(modal_el.offset_top() - position.1 - scroll_top);
|
||||||
|
|
||||||
let _ = modal_el.attr("style", format!("transform-origin: {}px {}px", x, y));
|
let _ = modal_el.attr("style", format!("transform-origin: {}px {}px", x, y));
|
||||||
};
|
});
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
<Teleport>
|
<Teleport>
|
||||||
|
|
Loading…
Add table
Reference in a new issue