ConceptPortal-public/rsconcept/frontend/src/components/info/InfoUsers.tsx

28 lines
803 B
TypeScript
Raw Normal View History

2024-05-27 20:42:34 +03:00
import clsx from 'clsx';
import { useLabelUser } from '@/backend/users/useLabelUser';
2024-05-27 20:42:34 +03:00
import { UserID } from '@/models/user';
import { CProps } from '../props';
interface InfoUsersProps extends CProps.Styling {
items: UserID[];
prefix: string;
2024-10-30 21:48:17 +03:00
header?: string;
2024-05-27 20:42:34 +03:00
}
2024-10-30 21:48:17 +03:00
function InfoUsers({ items, className, prefix, header, ...restProps }: InfoUsersProps) {
const getUserLabel = useLabelUser();
2024-05-27 20:42:34 +03:00
return (
<div className={clsx('flex flex-col dense', className)} {...restProps}>
2024-10-30 21:48:17 +03:00
{header ? <h2>{header}</h2> : null}
2024-05-27 20:42:34 +03:00
{items.map((user, index) => (
<div key={`${prefix}${index}`}>{getUserLabel(user)}</div>
))}
2024-08-21 21:36:29 +03:00
{items.length === 0 ? <div className='text-center'>Пользователи не выбраны</div> : null}
2024-05-27 20:42:34 +03:00
</div>
);
}
export default InfoUsers;