Create weathericon.tsx
Browse files- weathericon.tsx +45 -0
weathericon.tsx
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
import type { Weather } from '../types';
|
| 3 |
+
|
| 4 |
+
interface WeatherIconProps {
|
| 5 |
+
condition: Weather['condition'];
|
| 6 |
+
className?: string;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
const WeatherIcon: React.FC<WeatherIconProps> = ({ condition, className = 'w-16 h-16 text-yellow-500' }) => {
|
| 10 |
+
switch (condition) {
|
| 11 |
+
case 'Sunny':
|
| 12 |
+
return (
|
| 13 |
+
<svg xmlns="http://www.w3.org/2000/svg" className={className} fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
|
| 14 |
+
<path strokeLinecap="round" strokeLinejoin="round" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z" />
|
| 15 |
+
</svg>
|
| 16 |
+
);
|
| 17 |
+
case 'Cloudy':
|
| 18 |
+
return (
|
| 19 |
+
<svg xmlns="http://www.w3.org/2000/svg" className={`${className} text-gray-500`} fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
|
| 20 |
+
<path strokeLinecap="round" strokeLinejoin="round" d="M3 15a4 4 0 004 4h9a5 5 0 10-.1-9.999 5.002 5.002 0 10-9.78 2.096A4.001 4.001 0 003 15z" />
|
| 21 |
+
</svg>
|
| 22 |
+
);
|
| 23 |
+
case 'Rainy':
|
| 24 |
+
return (
|
| 25 |
+
<svg xmlns="http://www.w3.org/2000/svg" className={`${className} text-blue-500`} fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
|
| 26 |
+
<path strokeLinecap="round" strokeLinejoin="round" d="M19.428 15.428a8 8 0 00-14.856 0M8 17h8M9 21h6" />
|
| 27 |
+
<path strokeLinecap="round" strokeLinejoin="round" d="M12 12v3m-2-3v3m4-3v3" />
|
| 28 |
+
</svg>
|
| 29 |
+
);
|
| 30 |
+
case 'Snowy':
|
| 31 |
+
return (
|
| 32 |
+
<svg xmlns="http://www.w3.org/2000/svg" className={`${className} text-cyan-400`} fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
|
| 33 |
+
<path strokeLinecap="round" strokeLinejoin="round" d="M12 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm0 18a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM22 12a1 1 0 01-1 1h-1a1 1 0 110-2h1a1 1 0 011 1zM4 12a1 1 0 01-1 1H2a1 1 0 110-2h1a1 1 0 011 1zm15.657-5.657a1 1 0 010 1.414l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 0zM6.343 17.657a1 1 0 010 1.414l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 0zm11.314 0a1 1 0 01-1.414 1.414l-.707-.707a1 1 0 011.414-1.414l.707.707zM6.343 6.343a1 1 0 01-1.414 1.414l-.707-.707a1 1 0 011.414-1.414l.707.707z" />
|
| 34 |
+
</svg>
|
| 35 |
+
);
|
| 36 |
+
default:
|
| 37 |
+
return (
|
| 38 |
+
<svg xmlns="http://www.w3.org/2000/svg" className={`${className} text-gray-500`} fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
|
| 39 |
+
<path strokeLinecap="round" strokeLinejoin="round" d="M13 10V3L4 14h7v7l9-11h-7z" />
|
| 40 |
+
</svg>
|
| 41 |
+
);
|
| 42 |
+
}
|
| 43 |
+
};
|
| 44 |
+
|
| 45 |
+
export default WeatherIcon;
|