您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Avatar.web.js 881B

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