2018-02-13 15:55:18 +00:00
|
|
|
// @flow
|
|
|
|
|
2017-02-27 21:42:28 +00:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
|
|
|
/**
|
2018-02-13 15:55:18 +00:00
|
|
|
* The type of the React {@link Component} props of {@link Avatar}.
|
2017-02-27 21:42:28 +00:00
|
|
|
*/
|
2018-02-13 15:55:18 +00:00
|
|
|
type Props = {
|
|
|
|
|
2017-02-27 21:42:28 +00:00
|
|
|
/**
|
2018-02-13 15:55:18 +00:00
|
|
|
* The URI of the {@link Avatar}.
|
2017-02-27 21:42:28 +00:00
|
|
|
*/
|
2018-02-13 15:55:18 +00:00
|
|
|
uri: string
|
|
|
|
};
|
2017-02-27 21:42:28 +00:00
|
|
|
|
2018-02-13 15:55:18 +00:00
|
|
|
/**
|
|
|
|
* Implements an avatar as a React/Web {@link Component}.
|
|
|
|
*/
|
|
|
|
export default class Avatar extends Component<Props> {
|
2017-02-27 21:42:28 +00:00
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
render() {
|
2017-06-05 18:00:02 +00:00
|
|
|
// Propagate all props of this Avatar but the ones consumed by this
|
|
|
|
// Avatar to the img it renders.
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
|
const { uri, ...props } = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<img
|
|
|
|
{ ...props }
|
|
|
|
src = { uri } />
|
|
|
|
);
|
2017-02-27 21:42:28 +00:00
|
|
|
}
|
|
|
|
}
|