diff --git a/src/App.css b/src/App.css index a4bc79d..a0846ca 100644 --- a/src/App.css +++ b/src/App.css @@ -181,3 +181,23 @@ border-right-color: var(--border); } } + +.list-item { + display: flex; + flex-direction: row; + justify-content: space-between; + background-color: #bcebff; + color: #000000; + padding: 10px; + border-radius: 15px; + width: 80%; + margin-right: 5px; + border: 1px solid #000000; +} + +@media (max-width: 512px) { + .list-item { + flex-direction: column; + height: auto; + } +} diff --git a/src/components/listItem.tsx b/src/components/listItem.tsx index 352c3c8..eeffeb1 100644 --- a/src/components/listItem.tsx +++ b/src/components/listItem.tsx @@ -1,27 +1,16 @@ +import "../App.css" + type cityWeather = { name?: string temperature?: number precipitation?: number - nextDays?: { time: string; temperature: number | undefined }[] + nextDays?: { time: string; temperature?: number; precipitation?: number }[] } const listItem = ({ city: item }: { city: cityWeather }) => { return ( -
  • - +
  • + {item.name}: {typeof item.precipitation === "number" && item.precipitation > 0.6 @@ -35,9 +24,19 @@ const listItem = ({ city: item }: { city: cityWeather }) => {

    -
    +
    {item.nextDays?.map((day) => ( - + + {typeof day.precipitation === "number" && day.precipitation > 0.6 + ? "🌧️" + : "⛅"} {typeof day.temperature === "number" ? `${day.temperature.toFixed()}°` : "—"} diff --git a/src/components/location-list.tsx b/src/components/location-list.tsx index 0b5f007..b0a8586 100644 --- a/src/components/location-list.tsx +++ b/src/components/location-list.tsx @@ -35,6 +35,7 @@ const getNextDays = (data?: WeatherApiResponse) => { }) .map((entry) => ({ time: entry.time, + precipitation: entry.data.next_6_hours?.details?.precipitation_amount, temperature: entry.data.instant.details?.air_temperature, }))