You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Avatar.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // @flow
  2. import React from 'react';
  3. import { Avatar } from '../../../avatar';
  4. import { connect } from '../../../redux';
  5. import { calculateAvatarDimensions } from '../../functions';
  6. type Props = {
  7. /**
  8. * The height of the window.
  9. */
  10. height: number,
  11. /**
  12. * The name of the participant (if any).
  13. */
  14. name: string
  15. }
  16. /**
  17. * Component displaying the avatar for the premeeting screen.
  18. *
  19. * @param {Props} props - The props of the component.
  20. * @returns {ReactElement}
  21. */
  22. function PremeetingAvatar({ height, name }: Props) {
  23. const { marginTop, size } = calculateAvatarDimensions(height);
  24. if (size <= 5) {
  25. return null;
  26. }
  27. return (
  28. <div style = {{ marginTop }}>
  29. <Avatar
  30. className = 'preview-avatar'
  31. displayName = { name }
  32. participantId = 'local'
  33. size = { size } />
  34. </div>
  35. );
  36. }
  37. /**
  38. * Maps (parts of) the redux state to the React {@code Component} props.
  39. *
  40. * @param {Object} state - The redux state.
  41. * @returns {{
  42. * height: number
  43. * }}
  44. */
  45. function mapStateToProps(state) {
  46. return {
  47. height: state['features/base/responsive-ui'].clientHeight
  48. };
  49. }
  50. export default connect(mapStateToProps)(PremeetingAvatar);