24 lines
523 B
JavaScript
24 lines
523 B
JavaScript
import React from "react";
|
|
import PropTypes from "prop-types";
|
|
import WeatherSunny from "./WeatherSunny";
|
|
import WeatherRainy from "./WeatherRainy";
|
|
import WeatherCloudy from "./WeatherCloudy";
|
|
|
|
export default function WeatherDisplay({ type }) {
|
|
const map = {
|
|
sunny: <WeatherSunny />,
|
|
rainy: <WeatherRainy />,
|
|
cloudy: <WeatherCloudy />
|
|
};
|
|
|
|
return (
|
|
<div className="weather-icon-wrapper">
|
|
{map[type] || null}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
WeatherDisplay.propTypes = {
|
|
type: PropTypes.oneOf(["sunny", "rainy", "cloudy"])
|
|
};
|