ConceptPortal-public/rsconcept/frontend/src/features/users/components/InfoUsers.tsx

26 lines
789 B
TypeScript
Raw Normal View History

2024-05-27 20:42:34 +03:00
import clsx from 'clsx';
2025-01-28 23:23:42 +03:00
import { CProps } from '@/components/props';
import { useLabelUser } from '../backend/useLabelUser';
import { UserID } from '../models/user';
2024-05-27 20:42:34 +03:00
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
}
export 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>
);
}