Skip to content

Commit

Permalink
Allow clicking on cards to skip over to them
Browse files Browse the repository at this point in the history
  • Loading branch information
samtay committed Sep 27, 2024
1 parent 1ea0a47 commit 3e3af07
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/src/ui/components/birdpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,21 @@ fn CardContainer(
transform: "rotate({degree(pos())}deg) translateX({degree(pos())}px)",
z_index: "{pack_size - pos()}",

// last
// last card animates to the back of the deck
class: if pos() == pack_size - 1 {
"animate-card-slide-out"
},

// click on the cards behind to skip over to them
class: if pos() > 0 {
"cursor-pointer"
},
onclick: move |_| {
if pos() > 0 {
position.with_mut(|p| *p = (*p + 1) % pack_size);
}
},

BirdCard {
extra_classes: "h-full w-full {bg_color(ix)}",
responsive: false,
Expand Down

0 comments on commit 3e3af07

Please sign in to comment.