feat: Add "Followers you know" widget to user profiles (#34652)
This commit is contained in:
parent
c9a554bdca
commit
b135a831ea
12 changed files with 213 additions and 17 deletions
34
app/javascript/mastodon/components/avatar_group.tsx
Normal file
34
app/javascript/mastodon/components/avatar_group.tsx
Normal file
|
@ -0,0 +1,34 @@
|
|||
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>
|
||||
);
|
||||
};
|
||||
|
||||
export const AvatarGroup: React.FC<{
|
||||
accountIds: string[];
|
||||
compact?: boolean;
|
||||
}> = ({ accountIds, compact = false }) => (
|
||||
<div
|
||||
className={classNames('avatar-group', { 'avatar-group--compact': compact })}
|
||||
>
|
||||
{accountIds.map((accountId) => (
|
||||
<AvatarWrapper key={accountId} accountId={accountId} />
|
||||
))}
|
||||
</div>
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue