2021-07-14 00:31:37 +02:00
|
|
|
import React from 'react';
|
2021-08-02 14:15:18 +02:00
|
|
|
import { useHistory } from 'react-router-dom';
|
2021-07-14 00:31:37 +02:00
|
|
|
import { useMovie } from '../hooks/useMovie'
|
|
|
|
import { Arrow } from '../components/Arrow'
|
|
|
|
import './Title.css'
|
|
|
|
|
|
|
|
// size: "big" | "medium" | "small" | null
|
|
|
|
// accent: string | null
|
|
|
|
// accentLink: string | null
|
|
|
|
export function Title(props) {
|
2021-08-02 14:15:18 +02:00
|
|
|
const { streamData, resetStreamData } = useMovie();
|
|
|
|
const history = useHistory();
|
2021-07-14 00:31:37 +02:00
|
|
|
const size = props.size || "big";
|
|
|
|
|
|
|
|
const accentLink = props.accentLink || "";
|
|
|
|
const accent = props.accent || "";
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
{accent.length > 0 ? (
|
2021-08-02 14:15:18 +02:00
|
|
|
<p onClick={() => {
|
|
|
|
if (accentLink.length > 0) {
|
|
|
|
history.push(`/${streamData.type}`);
|
|
|
|
resetStreamData();
|
|
|
|
}
|
|
|
|
}} className={`title-accent ${accentLink.length > 0 ? 'title-accent-link' : ''}`}>
|
2021-07-14 00:31:37 +02:00
|
|
|
{accentLink.length > 0 ? (<Arrow left/>) : null}{accent}
|
|
|
|
</p>
|
|
|
|
) : null}
|
|
|
|
<h1 className={"title " + ( size ? 'title-size-' + size : '' )}>{props.children}</h1>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|