refactor: Remove duplicated AvatarGroup CSS and familiar followers cleanup (#34681)

This commit is contained in:
diondiondion 2025-05-15 10:07:38 +02:00 committed by GitHub
commit ccffa11f2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 110 additions and 100 deletions

View file

@ -1,34 +1,17 @@
import classNames from 'classnames';
import { Link } from 'react-router-dom';
import { Avatar } from 'mastodon/components/avatar';
import { useAppSelector } from 'mastodon/store';
const AvatarWrapper: React.FC<{ accountId: string }> = ({ accountId }) => {
const account = useAppSelector((state) => state.accounts.get(accountId));
if (!account) return null;
return (
<Link
to={`/@${account.acct}`}
title={`@${account.acct}`}
data-hover-card-account={account.id}
>
<Avatar account={account} size={28} />
</Link>
);
};
/**
* Wrapper for displaying a number of Avatar components horizontally,
* either spaced out (default) or overlapping (using the `compact` prop).
*/
export const AvatarGroup: React.FC<{
accountIds: string[];
compact?: boolean;
}> = ({ accountIds, compact = false }) => (
children: React.ReactNode;
}> = ({ children, compact = false }) => (
<div
className={classNames('avatar-group', { 'avatar-group--compact': compact })}
>
{accountIds.map((accountId) => (
<AvatarWrapper key={accountId} accountId={accountId} />
))}
{children}
</div>
);