2020-02-05 12:40:30 +00:00
|
|
|
import React from "react";
|
2020-01-20 07:39:31 +00:00
|
|
|
import PropTypes from 'prop-types';
|
2020-02-05 12:40:30 +00:00
|
|
|
import { Avatar, DropDown } from 'asc-web-components';
|
2020-01-20 07:39:31 +00:00
|
|
|
import {
|
|
|
|
AvatarContainer,
|
|
|
|
LabelContainer,
|
2020-02-05 12:40:30 +00:00
|
|
|
MainLabelContainer,
|
|
|
|
MenuContainer,
|
|
|
|
StyledProfileMenu,
|
2020-01-20 07:39:31 +00:00
|
|
|
TopArrow
|
|
|
|
} from "./StyledProfileMenu";
|
|
|
|
|
2020-02-05 12:40:30 +00:00
|
|
|
class ProfileMenu extends React.Component {
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
avatarRole,
|
|
|
|
avatarSource,
|
|
|
|
children,
|
|
|
|
className,
|
|
|
|
displayName,
|
|
|
|
email,
|
|
|
|
clickOutsideAction,
|
|
|
|
open
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<DropDown
|
|
|
|
className={className}
|
|
|
|
directionX='right'
|
|
|
|
open={open}
|
|
|
|
clickOutsideAction={clickOutsideAction}
|
|
|
|
>
|
|
|
|
<StyledProfileMenu>
|
|
|
|
<MenuContainer>
|
|
|
|
<AvatarContainer>
|
|
|
|
<Avatar
|
|
|
|
size='medium'
|
|
|
|
role={avatarRole}
|
|
|
|
source={avatarSource}
|
|
|
|
userName={displayName}
|
|
|
|
/>
|
|
|
|
</AvatarContainer>
|
|
|
|
<MainLabelContainer>
|
|
|
|
{displayName}
|
|
|
|
</MainLabelContainer>
|
|
|
|
<LabelContainer>
|
|
|
|
{email}
|
|
|
|
</LabelContainer>
|
|
|
|
</MenuContainer>
|
|
|
|
<TopArrow />
|
|
|
|
</StyledProfileMenu>
|
|
|
|
{children}
|
|
|
|
</DropDown>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2020-01-20 07:39:31 +00:00
|
|
|
|
2020-02-05 12:40:30 +00:00
|
|
|
ProfileMenu.displayName = 'ProfileMenu';
|
2020-01-20 07:39:31 +00:00
|
|
|
|
|
|
|
ProfileMenu.propTypes = {
|
|
|
|
avatarRole: PropTypes.oneOf(['owner', 'admin', 'guest', 'user']),
|
|
|
|
avatarSource: PropTypes.string,
|
2020-02-05 12:40:30 +00:00
|
|
|
children: PropTypes.any,
|
2020-01-20 07:39:31 +00:00
|
|
|
className: PropTypes.string,
|
|
|
|
displayName: PropTypes.string,
|
|
|
|
email: PropTypes.string,
|
|
|
|
id: PropTypes.string,
|
2020-02-05 12:40:30 +00:00
|
|
|
open: PropTypes.bool,
|
|
|
|
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
|
|
clickOutsideAction: PropTypes.func,
|
2020-01-20 07:39:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default ProfileMenu
|