1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-12 21:30:39 +00:00

add participant avatar tooltip

This commit is contained in:
Michael An
2019-06-29 14:35:55 +08:00
parent 2384aa0c05
commit 74360f8484

View File

@@ -37,7 +37,7 @@ class ParticipantsList extends React.Component {
return (
<div className="participants mb-2 position-relative">
{participants.map((item, index) => {
return <img src={item.avatar_url} className="avatar" alt="avatar" key={index} style={{left: index * -7 + 'px'}}/>;
return <Participant item={item} index={index} key={index}/>;
})}
<span className="add-participants" style={{left: participants.length * 21, top: 8 }} onClick={this.toggleDialog} id="add-participant-icon">
<i className="fas fa-plus-circle"></i>
@@ -65,4 +65,38 @@ class ParticipantsList extends React.Component {
ParticipantsList.propTypes = propTypes;
const ParticipantPropTypes = {
index: PropTypes.number.isRequired,
item: PropTypes.object.isRequired,
};
class Participant extends React.Component {
constructor(props) {
super(props);
this.state = {
showAvatarTooltip: false,
};
}
toggleAvatarTooltip = () => {
this.setState({ showAvatarTooltip: !this.state.showAvatarTooltip });
}
render() {
const { item, index } = this.props;
const target = 'participant-avatar-' + index;
return (
<span>
<img src={item.avatar_url} className="avatar" id={target} alt="avatar" key={index} style={{left: index * -7 + 'px'}}/>
<Tooltip toggle={this.toggleAvatarTooltip} delay={{show: 0, hide: 0}} target={target} placement='bottom' isOpen={this.state.showAvatarTooltip}>
{item.name}
</Tooltip>
</span>
);
}
}
Participant.propTypes = ParticipantPropTypes;
export default ParticipantsList;