2020-12-29 19:39:30 +00:00
|
|
|
import style from './ActorTile.module.css';
|
|
|
|
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
|
|
|
|
import {faUser} from '@fortawesome/free-solid-svg-icons';
|
|
|
|
import React from 'react';
|
|
|
|
import {Link} from 'react-router-dom';
|
2021-01-22 21:05:21 +00:00
|
|
|
import {ActorType} from '../../types/VideoTypes';
|
2020-12-29 19:39:30 +00:00
|
|
|
|
2021-03-14 14:51:53 +00:00
|
|
|
interface Props {
|
2020-12-29 19:39:30 +00:00
|
|
|
actor: ActorType;
|
2021-03-14 14:51:53 +00:00
|
|
|
onClick?: (actor: ActorType) => void;
|
2020-12-29 19:39:30 +00:00
|
|
|
}
|
|
|
|
|
2021-03-14 14:51:53 +00:00
|
|
|
class ActorTile extends React.Component<Props> {
|
|
|
|
constructor(props: Props) {
|
2020-12-29 19:39:30 +00:00
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {};
|
|
|
|
}
|
|
|
|
|
|
|
|
render(): JSX.Element {
|
|
|
|
if (this.props.onClick) {
|
|
|
|
return this.renderActorTile(this.props.onClick);
|
|
|
|
} else {
|
2021-03-14 14:51:53 +00:00
|
|
|
return <Link to={{pathname: '/actors/' + this.props.actor.ActorId}}>{this.renderActorTile(() => {})}</Link>;
|
2020-12-29 19:39:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-31 17:14:02 +01:00
|
|
|
/**
|
|
|
|
* render the Actor Tile with its pic
|
|
|
|
* @param customclickhandler a custom click handler to be called onclick instead of Link
|
|
|
|
*/
|
|
|
|
private renderActorTile(customclickhandler: (actor: ActorType) => void): JSX.Element {
|
2020-12-29 19:39:30 +00:00
|
|
|
return (
|
|
|
|
<div className={style.actortile} onClick={(): void => customclickhandler(this.props.actor)}>
|
|
|
|
<div className={style.actortile_thumbnail}>
|
2021-03-14 14:51:53 +00:00
|
|
|
{
|
|
|
|
this.props.actor.Thumbnail === '' ? (
|
|
|
|
<FontAwesomeIcon
|
|
|
|
style={{
|
|
|
|
lineHeight: '130px'
|
|
|
|
}}
|
|
|
|
icon={faUser}
|
|
|
|
size='5x'
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
'dfdf'
|
|
|
|
) /* todo render picture provided here! */
|
|
|
|
}
|
2020-12-29 19:39:30 +00:00
|
|
|
</div>
|
2021-02-23 16:01:29 +00:00
|
|
|
<div className={style.actortile_name}>{this.props.actor.Name}</div>
|
2020-12-29 19:39:30 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ActorTile;
|