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.web.js 782B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // @flow
  2. import React, { Component } from 'react';
  3. /**
  4. * The type of the React {@link Component} props of {@link Avatar}.
  5. */
  6. type Props = {
  7. /**
  8. * The URI of the {@link Avatar}.
  9. */
  10. uri: string
  11. };
  12. /**
  13. * Implements an avatar as a React/Web {@link Component}.
  14. */
  15. export default class Avatar extends Component<Props> {
  16. /**
  17. * Implements React's {@link Component#render()}.
  18. *
  19. * @inheritdoc
  20. */
  21. render() {
  22. // Propagate all props of this Avatar but the ones consumed by this
  23. // Avatar to the img it renders.
  24. // eslint-disable-next-line no-unused-vars
  25. const { uri, ...props } = this.props;
  26. return (
  27. <img
  28. { ...props }
  29. src = { uri } />
  30. );
  31. }
  32. }