From 02abeab4f565f129bd0cd68e98fccfd4c4ac1e4e Mon Sep 17 00:00:00 2001 From: kawamataryo Date: Thu, 17 Aug 2023 20:03:49 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20state-derived=20properties=20and?= =?UTF-8?q?=20chidren?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/components/BskyUserCell.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/lib/components/BskyUserCell.ts b/src/lib/components/BskyUserCell.ts index 90ebf1a..ec9d991 100644 --- a/src/lib/components/BskyUserCell.ts +++ b/src/lib/components/BskyUserCell.ts @@ -1,7 +1,8 @@ import type { ProfileView, ViewerState } from "@atproto/api/dist/client/types/app/bsky/actor/defs" import van from 'vanjs-core' -const { a, div, p, img, button } = van.tags + +const { a, div, p, img, button, span } = van.tags export type UserCellBtnLabel = { add: string, @@ -46,7 +47,7 @@ const ActionButton = ({ statusKey, profile, btnLabel, addAction, removeAction }: } const onMouseover = () => { - if( + if ( isProcessing.val || isJustApplied.val || !isStateOfBeing.val @@ -59,18 +60,18 @@ const ActionButton = ({ statusKey, profile, btnLabel, addAction, removeAction }: if (isJustApplied.val) { isJustApplied.val = false } - if(!isStateOfBeing.val) return + if (!isStateOfBeing.val) return label.val = `${btnLabel.progressive} on Bluesky` } - return () => button({ - class: `action-button ${beingClass.val} ${processingClass.val} ${justAppliedClass.val}`, + return button({ + class: () => `action-button ${beingClass.val} ${processingClass.val} ${justAppliedClass.val}`, onclick: onClick, onmouseover: onMouseover, onmouseout: onMouseout, }, - label.val, + () => label.val, ) } @@ -92,7 +93,7 @@ export const BskyUserCell = ({ removeAction: () => Promise }) => { return div({ class: "bsky-user-content" }, - div({ class: "icon-section"}, + div({ class: "icon-section" }, a({ href: `https://bsky.app/profile/${profile.handle}`, target: "_blank", rel: "noopener" }, Avatar({ avatar: profile.avatar }), ),