1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-19 17:32:38 +01:00

Convert MovieTitleLink to TypeScript

Closes #10322
This commit is contained in:
Bogdan 2024-08-24 04:29:45 +03:00
parent 540659a799
commit 644876123d
2 changed files with 26 additions and 33 deletions

View File

@ -1,33 +0,0 @@
import PropTypes from 'prop-types';
import React, { PureComponent } from 'react';
import Link from 'Components/Link/Link';
class MovieTitleLink extends PureComponent {
render() {
const {
titleSlug,
title,
year
} = this.props;
const link = `/movie/${titleSlug}`;
return (
<Link
to={link}
title={title}
>
{title}{year > 0 ? ` (${year})` : ''}
</Link>
);
}
}
MovieTitleLink.propTypes = {
titleSlug: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
year: PropTypes.number
};
export default MovieTitleLink;

View File

@ -0,0 +1,26 @@
import React from 'react';
import Link, { LinkProps } from 'Components/Link/Link';
interface MovieTitleLinkProps extends LinkProps {
titleSlug: string;
title: string;
year?: number;
}
function MovieTitleLink({
titleSlug,
title,
year = 0,
...otherProps
}: MovieTitleLinkProps) {
const link = `/movie/${titleSlug}`;
return (
<Link to={link} title={title} {...otherProps}>
{title}
{year > 0 ? ` (${year})` : ''}
</Link>
);
}
export default MovieTitleLink;