mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-15 02:18:51 +01:00
Further enhance actions bar
- Focus color when context menu is open - Focus color for more button when context menu is open - Reuse menu instead of creating another menu - Show like toast when liked/unliked
This commit is contained in:
parent
9b0889fe23
commit
04179340f6
2 changed files with 55 additions and 27 deletions
|
@ -1822,6 +1822,20 @@ a.card:is(:hover, :focus):visited {
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
transform: scale(1);
|
transform: scale(1);
|
||||||
}
|
}
|
||||||
|
.status:has(&):hover {
|
||||||
|
transition: background-color 0.1s ease-out 0.3s;
|
||||||
|
background-color: var(--bg-faded-blur-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.open {
|
||||||
|
button.more-button {
|
||||||
|
background-color: var(--outline-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
button:not(.more-button) {
|
||||||
|
opacity: 0.3;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* BADGE */
|
/* BADGE */
|
||||||
|
@ -1922,6 +1936,12 @@ a.card:is(:hover, :focus):visited {
|
||||||
font-size: 80%;
|
font-size: 80%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* MENU OPEN */
|
||||||
|
|
||||||
|
.status-menu-open {
|
||||||
|
background-color: var(--link-bg-hover-color) !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* FILTERED */
|
/* FILTERED */
|
||||||
|
|
||||||
#filtered-status-peek {
|
#filtered-status-peek {
|
||||||
|
|
|
@ -1266,7 +1266,9 @@ function Status({
|
||||||
m: 'medium',
|
m: 'medium',
|
||||||
l: 'large',
|
l: 'large',
|
||||||
}[size]
|
}[size]
|
||||||
} ${_deleted ? 'status-deleted' : ''} ${quoted ? 'status-card' : ''}`}
|
} ${_deleted ? 'status-deleted' : ''} ${quoted ? 'status-card' : ''} ${
|
||||||
|
isContextMenuOpen ? 'status-menu-open' : ''
|
||||||
|
}`}
|
||||||
onMouseEnter={debugHover}
|
onMouseEnter={debugHover}
|
||||||
onContextMenu={(e) => {
|
onContextMenu={(e) => {
|
||||||
// FIXME: this code isn't getting called on Chrome at all?
|
// FIXME: this code isn't getting called on Chrome at all?
|
||||||
|
@ -1319,7 +1321,10 @@ function Status({
|
||||||
</ControlledMenu>
|
</ControlledMenu>
|
||||||
)}
|
)}
|
||||||
{showActionsBar && size !== 'l' && !previewMode && !readOnly && (
|
{showActionsBar && size !== 'l' && !previewMode && !readOnly && (
|
||||||
<div class="status-actions" ref={actionsRef}>
|
<div
|
||||||
|
class={`status-actions ${isContextMenuOpen ? 'open' : ''}`}
|
||||||
|
ref={actionsRef}
|
||||||
|
>
|
||||||
<StatusButton
|
<StatusButton
|
||||||
size="s"
|
size="s"
|
||||||
title="Reply"
|
title="Reply"
|
||||||
|
@ -1338,34 +1343,37 @@ function Status({
|
||||||
icon="heart"
|
icon="heart"
|
||||||
iconSize="m"
|
iconSize="m"
|
||||||
count={favouritesCount}
|
count={favouritesCount}
|
||||||
onClick={favouriteStatus}
|
onClick={() => {
|
||||||
/>
|
try {
|
||||||
<Menu2
|
favouriteStatus();
|
||||||
portal={{
|
showToast(
|
||||||
target: document.querySelector('.status-deck') || document.body,
|
favourited
|
||||||
|
? `Unliked @${username || acct}'s post`
|
||||||
|
: `Liked @${username || acct}'s post`,
|
||||||
|
);
|
||||||
|
} catch (e) {}
|
||||||
}}
|
}}
|
||||||
align="end"
|
/>
|
||||||
gap={4}
|
<button
|
||||||
overflow="auto"
|
type="button"
|
||||||
viewScroll="close"
|
title="More"
|
||||||
menuButton={({ open }) => {
|
class="plain more-button"
|
||||||
if (actionsRef.current) {
|
onClick={(e) => {
|
||||||
actionsRef.current.classList.toggle('open', open);
|
e.preventDefault();
|
||||||
}
|
e.stopPropagation();
|
||||||
return (
|
setContextMenuProps({
|
||||||
<button
|
anchorRef: {
|
||||||
type="button"
|
current: e.currentTarget,
|
||||||
title="More"
|
},
|
||||||
class="plain more-button"
|
align: 'end',
|
||||||
onClick={(e) => e.preventDefault()}
|
direction: 'bottom',
|
||||||
>
|
gap: 4,
|
||||||
<Icon icon="more2" size="m" alt="More" />
|
});
|
||||||
</button>
|
setIsContextMenuOpen(true);
|
||||||
);
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{StatusMenuItems}
|
<Icon icon="more2" size="m" alt="More" />
|
||||||
</Menu2>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{size !== 'l' && (
|
{size !== 'l' && (
|
||||||
|
|
Loading…
Reference in a new issue