File size: 974 Bytes
f5071ca |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import React from "react";
import { IMAGE_BASE_URL, PROFILE_SIZE } from "../../Config/config";
import './ItemPageCast.scss';
class ItemPageCast extends React.Component {
constructor(props) {
super(props);
this.state = {
didLoad: false
};
}
onLoad = () => {
this.setState({ didLoad: true });
};
render() {
const { profile_path, name } = this.props;
const profileUrl = `${IMAGE_BASE_URL}${PROFILE_SIZE}`;
const style = this.state.didLoad ? {} : { visibility: "hidden" };
return (
<div className="cast">
<div className="cast__img-box">
<img
src={`${profileUrl}/${profile_path}`}
style={style}
alt="profile"
className="cast__img"
onLoad={this.onLoad}
/>
</div>
<span style={style} className="cast__name">{`${name}`}</span>
</div>
);
}
}
export default ItemPageCast;
|