mirror of https://github.com/mastodon/mastodon
refactor: Remove duplicated `AvatarGroup` CSS and familiar followers cleanup (#34681)
parent
d475bcce65
commit
ccffa11f2b
@ -1,34 +1,17 @@
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { Link } from 'react-router-dom';
|
|
||||||
|
|
||||||
import { Avatar } from 'mastodon/components/avatar';
|
/**
|
||||||
import { useAppSelector } from 'mastodon/store';
|
* Wrapper for displaying a number of Avatar components horizontally,
|
||||||
|
* either spaced out (default) or overlapping (using the `compact` prop).
|
||||||
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>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const AvatarGroup: React.FC<{
|
export const AvatarGroup: React.FC<{
|
||||||
accountIds: string[];
|
|
||||||
compact?: boolean;
|
compact?: boolean;
|
||||||
}> = ({ accountIds, compact = false }) => (
|
children: React.ReactNode;
|
||||||
|
}> = ({ children, compact = false }) => (
|
||||||
<div
|
<div
|
||||||
className={classNames('avatar-group', { 'avatar-group--compact': compact })}
|
className={classNames('avatar-group', { 'avatar-group--compact': compact })}
|
||||||
>
|
>
|
||||||
{accountIds.map((accountId) => (
|
{children}
|
||||||
<AvatarWrapper key={accountId} accountId={accountId} />
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue