Refactor
This commit is contained in:
parent
806d72e58a
commit
f6b67cfbb2
|
@ -8,14 +8,13 @@ const SearchResult = ({ items }: SearchResultProps) => (
|
|||
<div className="search-result-wrapper">
|
||||
{items.length > 0 && items.map((item) => {
|
||||
const { Title, Poster, imdbID, Year, Type } = item;
|
||||
const yearSanitized = Year.length > 4 ? `${Year.substring(0, 4)}..` : Year;
|
||||
return (
|
||||
<SearchResultItem
|
||||
title={Title}
|
||||
image={Poster}
|
||||
imdbId={imdbID}
|
||||
key={Poster}
|
||||
year={yearSanitized}
|
||||
year={Year}
|
||||
type={Type}
|
||||
/>
|
||||
);
|
||||
|
|
|
@ -27,7 +27,7 @@ const SearchResultItem = ({
|
|||
<section>
|
||||
<div className="search-result-item-meta">
|
||||
<span className="search-result-item-year">
|
||||
{year}
|
||||
{year.substring(0, 4)}
|
||||
</span>
|
||||
|
||||
-
|
||||
|
|
Loading…
Reference in a new issue