mirror of
https://github.com/duckietm/Nitro-Cool-UI.git
synced 2025-06-21 22:36:58 +00:00
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import { FC, useMemo } from 'react';
|
|
import { AvatarInfoName, GetSessionDataManager } from '../../../../../api';
|
|
import { ContextMenuView } from '../../context-menu/ContextMenuView';
|
|
|
|
interface AvatarInfoWidgetNameViewProps
|
|
{
|
|
nameInfo: AvatarInfoName;
|
|
onClose: () => void;
|
|
}
|
|
|
|
export const AvatarInfoWidgetNameView: FC<AvatarInfoWidgetNameViewProps> = props =>
|
|
{
|
|
const { nameInfo = null, onClose = null } = props;
|
|
|
|
const getClassNames = useMemo(() =>
|
|
{
|
|
const newClassNames: string[] = [ 'name-only' ];
|
|
|
|
if(nameInfo.isFriend) newClassNames.push('is-friend');
|
|
|
|
return newClassNames;
|
|
}, [ nameInfo ]);
|
|
|
|
return (
|
|
<ContextMenuView objectId={ nameInfo.roomIndex } category={ nameInfo.category } userType={ nameInfo.userType } fades={ (nameInfo.id !== GetSessionDataManager().userId) } classNames={ getClassNames } onClose={ onClose }>
|
|
<div className="text-shadow" dangerouslySetInnerHTML={ { __html: `${ nameInfo.name }` } }></div>
|
|
</ContextMenuView>
|
|
);
|
|
}
|