Files
web-Iot/src/components/Weather/index.jsx
2026-05-12 14:13:54 +08:00

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"])
};