diff --git a/src/App.tsx b/src/App.tsx index 0cbeceb..40dbb55 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,18 +1,19 @@ import React, { useRef, useState } from "react"; -import { Button, CardGroup, Container, FormControl, FormGroup, FormLabel, Row } from "react-bootstrap"; +import { Button, Card, Container, FormControl, FormGroup, FormLabel, Row } from "react-bootstrap"; import client from "./ApiClient"; +import { Band } from "./Types"; function App() { const searchRef = useRef(null); - const [bands, setBands] = useState([]); + const [bands, setBands] = useState([]); const search = () => { const input = searchRef.current?.value; if (!input) { return; } - client.searchBand(input).then((res) => setBands(res.bands)); + client.searchBand(input).then((res) => setBands(res)); }; return ( @@ -25,10 +26,22 @@ function App() { - {bands && bands.map((band) =>
{band}
)}
+ {bands && + bands.map((band) => ( + + + {band.name} + {getBioText(band)} + + ))}
); } +function getBioText(band: Band): string { + const bio = band.biographies.find((bio) => bio.lang === "de") || band.biographies[0]; + return bio?.description || "Keine Biographie angegeben."; +} + export default App;