feat(ui): added content ratings for tv shows and movie ratings (#878)

This commit is contained in:
Danshil Mungur
2021-02-09 12:24:07 +04:00
committed by GitHub
parent 4e03c1efcf
commit c8b2a57721
8 changed files with 138 additions and 6 deletions

View File

@@ -129,7 +129,22 @@ const MovieDetails: React.FC<MovieDetailsProps> = ({ movie }) => {
revalidate();
};
const movieAttributes = [];
const movieAttributes: React.ReactNode[] = [];
if (
data.releases.results.length &&
(data.releases.results.find((r) => r.iso_3166_1 === 'US')?.release_dates[0]
.certification ||
data.releases.results[0].release_dates[0].certification)
) {
movieAttributes.push(
<span className="p-0.5 py-0 border rounded-md">
{data.releases.results.find((r) => r.iso_3166_1 === 'US')
?.release_dates[0].certification ||
data.releases.results[0].release_dates[0].certification}
</span>
);
}
if (data.runtime) {
movieAttributes.push(
@@ -369,7 +384,13 @@ const MovieDetails: React.FC<MovieDetailsProps> = ({ movie }) => {
)}
</h1>
<span className="mt-1 text-xs lg:text-base lg:mt-0">
{movieAttributes.join(' | ')}
{movieAttributes
.map((t, k) => <span key={k}>{t}</span>)
.reduce((prev, curr) => (
<>
{prev} | {curr}
</>
))}
</span>
</div>
<div className="relative z-10 flex flex-wrap justify-center flex-shrink-0 mt-4 sm:justify-end sm:flex-nowrap lg:mt-0">