mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-06 09:31:35 -04:00
refactor: split avatar component to handle displaynames
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
3a06f84af1
commit
e97a426680
9 changed files with 88 additions and 44 deletions
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import type { UserInfo } from '../../../api/users/types'
|
||||
import type { UserAvatarProps } from './user-avatar'
|
||||
import { UserAvatar } from './user-avatar'
|
||||
import React from 'react'
|
||||
|
||||
export interface UserAvatarForUserProps extends Omit<UserAvatarProps, 'photoUrl' | 'displayName'> {
|
||||
user: UserInfo
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the avatar image of a user, optionally altogether with their name.
|
||||
*
|
||||
* @param user The user object with the display name and photo.
|
||||
* @param props remaining avatar props
|
||||
*/
|
||||
export const UserAvatarForUser: React.FC<UserAvatarForUserProps> = ({ user, ...props }) => {
|
||||
return <UserAvatar displayName={user.displayName} photoUrl={user.photo} {...props} />
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue