lukas c13e758301 Merge branch 'master' into threedotsonvideohover
# Conflicts:
#	src/elements/Preview/Preview.tsx
#	src/elements/Tag/Tag.tsx
#	src/pages/Player/Player.tsx
2021-07-29 19:49:56 +02:00

57 lines
1.9 KiB
TypeScript

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';
import {ActorType} from '../../types/VideoTypes';
interface Props {
actor: ActorType;
onClick?: (actor: ActorType) => void;
}
class ActorTile extends React.Component<Props> {
constructor(props: Props) {
super(props);
this.state = {};
}
render(): JSX.Element {
if (this.props.onClick) {
return this.renderActorTile(this.props.onClick);
} else {
return <Link to={{pathname: '/actors/' + this.props.actor.ActorId}}>{this.renderActorTile(() => {})}</Link>;
}
}
/**
* 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 {
return (
<div className={style.actortile} onClick={(): void => customclickhandler(this.props.actor)}>
<div className={style.actortile_thumbnail}>
{
this.props.actor.Thumbnail === '' ? (
<FontAwesomeIcon
style={{
lineHeight: '130px'
}}
icon={faUser}
size='5x'
/>
) : (
'dfdf'
) /* todo render picture provided here! */
}
</div>
<div className={style.actortile_name}>{this.props.actor.Name}</div>
</div>
);
}
}
export default ActorTile;