39b0552b6a
Some fixes for the CSS / Phosphor revamp - Corrected avatar position - Corrected various button/icon sizes - Change the way a status background is set - Improved icon-button disabled state - Improved contrast and light theme colours commitb307fa93b4Author: Zoë Bijl <code@moiety.me> Date: Wed Oct 15 17:49:11 2025 +0200 [chore] lint commit1352425b81Author: Zoë Bijl <code@moiety.me> Date: Wed Oct 15 17:46:42 2025 +0200 [chore] lint commit276480b5a4Author: Zoë Bijl <code@moiety.me> Date: Wed Oct 15 17:46:32 2025 +0200 [bugfix] set direct message background commit4e5764a70bAuthor: Zoë Bijl <code@moiety.me> Date: Wed Oct 15 17:44:46 2025 +0200 [bugfix] improve obviousness of disabled icon button state commitdec5bb66e7Author: Zoë Bijl <code@moiety.me> Date: Wed Oct 15 16:52:55 2025 +0200 [chore] lint commit72869917abAuthor: Zoë Bijl <code@moiety.me> Date: Wed Oct 15 16:52:44 2025 +0200 [bugfix] start work on status content spacing commit5aa8333f71Author: Zoë Bijl <code@moiety.me> Date: Wed Oct 15 15:57:56 2025 +0200 lint commitdf0bb84ce4Author: Zoë Bijl <code@moiety.me> Date: Wed Oct 15 15:57:48 2025 +0200 [bugfix] correctly set status background (on focus) fixes an issue where a weird gradient would show up in the status__info section commit2fab5ff2e7Author: Zoë Bijl <code@moiety.me> Date: Wed Oct 15 09:40:28 2025 +0200 [bugfix] fix lint issues commit5d823b2195Author: Zoë Bijl <code@moiety.me> Date: Wed Oct 15 01:19:01 2025 +0200 [bugfix] set avatars to cover available space no more squashed avatars
57 lines
1.3 KiB
TypeScript
57 lines
1.3 KiB
TypeScript
import * as React from "react";
|
|
|
|
import classNames from "classnames";
|
|
|
|
import { useHovering } from "flavours/glitch/hooks/useHovering";
|
|
import { autoPlayGif } from "flavours/glitch/initial_state";
|
|
import { type Account } from "flavours/glitch/types/resources";
|
|
|
|
interface Props {
|
|
account: Account | undefined,
|
|
className?: string,
|
|
size: number,
|
|
style?: React.CSSProperties,
|
|
inline?: boolean,
|
|
}
|
|
|
|
export const Avatar: React.FC<Props> = ({
|
|
account,
|
|
className,
|
|
size = 20,
|
|
inline = false,
|
|
style: styleFromParent,
|
|
}) => {
|
|
const { hovering, handleMouseEnter, handleMouseLeave } =
|
|
useHovering(autoPlayGif);
|
|
|
|
const style = {
|
|
...styleFromParent,
|
|
width: `${size}px`,
|
|
height: `${size}px`,
|
|
backgroundSize: "cover",
|
|
backgroundPosition: "center",
|
|
};
|
|
|
|
if (account) {
|
|
style.backgroundImage = `url(${account.get(
|
|
hovering ? "avatar" : "avatar_static",
|
|
)})`;
|
|
}
|
|
|
|
return (
|
|
<div
|
|
className={classNames(
|
|
"account__avatar",
|
|
{ "account__avatar-inline": inline },
|
|
className,
|
|
)}
|
|
onMouseEnter={handleMouseEnter}
|
|
onMouseLeave={handleMouseLeave}
|
|
style={style}
|
|
data-avatar-of={account && `@${account.get("acct")}`}
|
|
role='img'
|
|
aria-label={account?.get("acct")}
|
|
/>
|
|
);
|
|
};
|