catstodon/app/assets/javascripts/components/components/avatar.jsx

23 lines
547 B
React
Raw Normal View History

import PureRenderMixin from 'react-addons-pure-render-mixin';
2016-08-24 21:08:00 +02:00
const Avatar = React.createClass({
propTypes: {
2016-08-31 22:58:10 +02:00
src: React.PropTypes.string.isRequired,
size: React.PropTypes.number.isRequired
2016-08-24 21:08:00 +02:00
},
mixins: [PureRenderMixin],
2016-08-24 21:08:00 +02:00
render () {
return (
2016-09-19 23:28:22 +02:00
<div style={{ width: `${this.props.size}px`, height: `${this.props.size}px` }}>
2016-08-31 22:58:10 +02:00
<img src={this.props.src} width={this.props.size} height={this.props.size} alt='' style={{ display: 'block', borderRadius: '4px' }} />
2016-08-24 21:08:00 +02:00
</div>
);
}
});
export default Avatar;