From f9bcb028944cb4f6bfd71c23a07ab9c1bb3fb127 Mon Sep 17 00:00:00 2001 From: familyfriendlymikey Date: Tue, 19 Jul 2022 18:49:27 -0400 Subject: [PATCH] move selection on hover --- app/client.imba | 19 +++++++++++-------- package.json | 2 +- sw.imba | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/app/client.imba b/app/client.imba index 67f87df..79a9ebe 100644 --- a/app/client.imba +++ b/app/client.imba @@ -150,6 +150,7 @@ tag app await db.put { name, link, frequency, last_opened, img } def handle_input + selection_index = 0 sort_links! def handle_click_delete link @@ -235,7 +236,6 @@ tag app bd:1px solid purple4 w:100% h:50px ta:center fs:20px bg:none rd:5px bc:purple4 outline:none c:blue3 caret-color:blue3 px:20px - transition:background 0.5s @focus bg:purple4/10 @placeholder fs:10px c:blue3 @@ -246,7 +246,7 @@ tag app css .link d:flex fld:row jc:space-between ai:center - px:15px py:10px rd:5px + px:15px py:10px rd:5px cursor:pointer css .selected bg:blue3/5 @@ -275,15 +275,14 @@ tag app css .delete bd:1px solid purple4/50 - transition:opacity 100ms px:7px rd:3px fs:15px mr:15px c:purple4 cursor:pointer o:0 - css .link@hover .delete + css .selected .delete o:100 css .link-left - d:flex fl:1 cursor:pointer + d:flex fl:1 css .link-right d:flex @@ -333,12 +332,16 @@ tag app if state.scored_links.length > 0 <.links> for obj, index in state.scored_links - <.link .selected=(index == selection_index)> - <.link-left@click.prevent=handle_click_link(obj)> + <.link + @pointerover=(selection_index = index) + @click.prevent=handle_click_link(obj) + .selected=(index == selection_index) + > + <.link-left> obj.name <.link-right> - <.delete@click=handle_click_delete(obj)> "x" + <.delete@click.prevent.stop=handle_click_delete(obj)> "x" <.frequency> obj.frequency else <.links> diff --git a/package.json b/package.json index 4a62105..5631501 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fuzzyhome", - "version": "0.0.27", + "version": "0.0.28", "scripts": { "start": "imba run -SMH --baseurl . -w server.imba", "build-app": "imba build -SMH --baseurl . server.imba", diff --git a/sw.imba b/sw.imba index 3b566b5..206403d 100644 --- a/sw.imba +++ b/sw.imba @@ -1,7 +1,7 @@ let p = console.log const app_prefix = "fuzzyhome_cache" -const version = "0.0.27" +const version = "0.0.28" const cache_name = "{app_prefix}-{version}"