2021-07-28 15:15:52 +02:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import './PeopleSelector.scss';
|
|
|
|
|
2021-11-23 07:26:02 +01:00
|
|
|
import { twemojify } from '../../../util/twemojify';
|
|
|
|
|
2021-07-28 15:15:52 +02:00
|
|
|
import { blurOnBubbling } from '../../atoms/button/script';
|
|
|
|
|
|
|
|
import Text from '../../atoms/text/Text';
|
|
|
|
import Avatar from '../../atoms/avatar/Avatar';
|
|
|
|
|
|
|
|
function PeopleSelector({
|
|
|
|
avatarSrc, name, color, peopleRole, onClick,
|
|
|
|
}) {
|
|
|
|
return (
|
|
|
|
<div className="people-selector__container">
|
|
|
|
<button
|
|
|
|
className="people-selector"
|
|
|
|
onMouseUp={(e) => blurOnBubbling(e, '.people-selector')}
|
|
|
|
onClick={onClick}
|
|
|
|
type="button"
|
|
|
|
>
|
2021-11-10 09:00:25 +01:00
|
|
|
<Avatar imageSrc={avatarSrc} text={name} bgColor={color} size="extra-small" />
|
2021-11-23 07:26:02 +01:00
|
|
|
<Text className="people-selector__name" variant="b1">{twemojify(name)}</Text>
|
2021-07-28 15:15:52 +02:00
|
|
|
{peopleRole !== null && <Text className="people-selector__role" variant="b3">{peopleRole}</Text>}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
PeopleSelector.defaultProps = {
|
|
|
|
avatarSrc: null,
|
|
|
|
peopleRole: null,
|
|
|
|
};
|
|
|
|
|
|
|
|
PeopleSelector.propTypes = {
|
|
|
|
avatarSrc: PropTypes.string,
|
|
|
|
name: PropTypes.string.isRequired,
|
|
|
|
color: PropTypes.string.isRequired,
|
|
|
|
peopleRole: PropTypes.string,
|
|
|
|
onClick: PropTypes.func.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default PeopleSelector;
|