Skip to content

Commit

Permalink
Improves create challenge modal layout,debounces sliders
Browse files Browse the repository at this point in the history
  • Loading branch information
IongIer committed Jan 18, 2024
1 parent 7ceedc8 commit 106c544
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 147 deletions.
1 change: 1 addition & 0 deletions apis/src/components/molecules/user_row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub fn UserRow(username: StoredValue<String>, rating: u64) -> impl IntoView {
</div>
<Show when=logged_in_and_not_user>
<button
title="Challenge to a game"
on:click=move |_| open.update(move |b| *b = true)
class="mx-2 bg-blue-500 hover:bg-blue-700 transform transition-transform duration-300 active:scale-95 py-2 px-4 rounded"
>
Expand Down
8 changes: 4 additions & 4 deletions apis/src/components/organisms/board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use leptos::ev::{
use leptos::svg::Svg;
use leptos::*;
use leptos_use::{
use_debounce_fn_with_arg, use_event_listener, use_event_listener_with_options,
use_resize_observer, UseEventListenerOptions,
use_event_listener, use_event_listener_with_options, use_resize_observer,
use_throttle_fn_with_arg, UseEventListenerOptions,
};
use wasm_bindgen::JsCast;
use web_sys::{DomRectReadOnly, PointerEvent, SvgPoint, TouchEvent, WheelEvent};
Expand Down Expand Up @@ -99,7 +99,7 @@ pub fn Board(
let svg_pos = SvgPos::center_for_level(initial_position, 0);

//on load and resize make sure to resize the viewbox
let debounced_resize = use_debounce_fn_with_arg(
let throttled_resize = use_throttle_fn_with_arg(
move |rect: DomRectReadOnly| {
viewbox_signal.try_update(|viewbox_controls: &mut ViewBoxControls| {
viewbox_controls.width = rect.width() as f32;
Expand All @@ -112,7 +112,7 @@ pub fn Board(
);
use_resize_observer(div_ref, move |entries, _observer| {
let rect = entries[0].content_rect();
debounced_resize(rect);
throttled_resize(rect);
});

//Start panning and record point where it starts for mouse on left mouse button hold and touch
Expand Down
Loading

0 comments on commit 106c544

Please sign in to comment.