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

23 lines
623 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 (
<div style={{ width: `${this.props.size}px`, height: `${this.props.size}px`, borderRadius: '4px', overflow: 'hidden' }} className='transparent-background'>
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;