Skip to content

Commit ef8a4f5

Browse files
authored
feat(FilmDirector): update to support multiple directors and improve rendering (#100)
* feat(FilmGrid): add initial loading state and improve loading indicators * feat(FilmDirector): update to support multiple directors and improve rendering
1 parent 92bad97 commit ef8a4f5

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/components/Film/Details/Info/FilmDirector.jsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
import Person from "../../../Person/Person";
22

33
export default function FilmDirector({ credits, film, isTvPage }) {
4-
const director = credits.crew.find((person) => person.job === "Director");
4+
const directors = credits.crew.filter((person) => person.job === "Director");
55

66
return (
77
<div className={`-mx-2`}>
88
{!isTvPage
99
? credits &&
10-
credits.crew.length > 0 &&
11-
director && (
10+
credits.crew.length > 0 && (
1211
<section
1312
id={`Movie Director`}
14-
className={`flex items-center gap-2`}
13+
className={`flex flex-wrap items-center`}
1514
>
16-
<Person
17-
id={director.id}
18-
name={director.name}
19-
profile_path={director.profile_path}
20-
role={`Director`}
21-
/>
15+
{directors.map((director) => {
16+
return (
17+
<Person
18+
key={director.id}
19+
id={director.id}
20+
name={director.name}
21+
profile_path={director.profile_path}
22+
role={director.job}
23+
/>
24+
);
25+
})}
2226
</section>
2327
)
2428
: film.created_by.length > 0 && (

0 commit comments

Comments
 (0)