-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweather.html
More file actions
222 lines (199 loc) · 12.6 KB
/
weather.html
File metadata and controls
222 lines (199 loc) · 12.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Weatherly</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
<!-- Toastr CSS -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
<link rel="stylesheet" href="style1.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="weather.js" defer></script>
</head>
<body>
<header class="flex flex-wrap items-center justify-between p-6 bg-[#D29EE8] shadow">
<!-- Navigation Bar -->
<nav class="bg-[#D29EE8] shadow-lg">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between items-center h-16">
<!-- Logo -->
<div class="flex items-center gap-2">
<svg xmlns="http://www.w3.org/2000/svg" class="w-8 h-8 text-[#4A2A6A]" viewBox="0 0 512 512">
<path d="M375.7 19.7c-1.5-8-6.9-14.7-14.4-17.8s-16.1-2.2-22.8 2.4L256 61.1 173.5 4.2c-6.7-4.6-15.3-5.5-22.8-2.4s-12.9 9.8-14.4 17.8l-18.1 98.5L19.7 136.3c-8 1.5-14.7 6.9-17.8 14.4s-2.2 16.1 2.4 22.8L61.1 256 4.2 338.5c-4.6 6.7-5.5 15.3-2.4 22.8s9.8 13 17.8 14.4l98.5 18.1 18.1 98.5c1.5 8 6.9 14.7 14.4 17.8s16.1 2.2 22.8-2.4L256 450.9l82.5 56.9c6.7 4.6 15.3 5.5 22.8 2.4s12.9-9.8 14.4-17.8l18.1-98.5 98.5-18.1c8-1.5 14.7-6.9 17.8-14.4s2.2-16.1-2.4-22.8L450.9 256l56.9-82.5c4.6-6.7 5.5-15.3 2.4-22.8s-9.8-12.9-17.8-14.4l-98.5-18.1L375.7 19.7zM269.6 110l65.6-45.2 14.4 78.3c1.8 9.8 9.5 17.5 19.3 19.3l78.3 14.4L402 242.4c-5.7 8.2-5.7 19 0 27.2l45.2 65.6-78.3 14.4c-9.8 1.8-17.5 9.5-19.3 19.3l-14.4 78.3L269.6 402c-8.2-5.7-19-5.7-27.2 0l-65.6 45.2-14.4-78.3c-1.8-9.8-9.5-17.5-19.3-19.3L64.8 335.2 110 269.6c5.7-8.2 5.7-19 0-27.2L64.8 176.8l78.3-14.4c9.8-1.8 17.5-9.5 19.3-19.3l14.4-78.3L242.4 110c8.2 5.7 19 5.7 27.2 0zM256 368a112 112 0 1 0 0-224 112 112 0 1 0 0 224zM192 256a64 64 0 1 1 128 0 64 64 0 1 1 -128 0z" />
</svg>
<span class="text-[#4A2A6A] text-2xl font-bold ml-2">Weatherly</span>
</div>
<!-- Desktop Menu -->
<div class="hidden md:flex space-x-6 m-6">
<a href="weather.html" class="nav-link text-[#4A2A6A] hover:text-[#5c3a8c] font-semibold nav-link">Dashboard</a>
<a href="favoritecities.html" class="text-[#4A2A6A] hover:text-[#5c3a8c] font-semibold nav-link">Favorite Cities</a>
<a href="searchhistory.html" class="text-[#4A2A6A] hover:text-[#5c3a8c] font-semibold nav-link">Search History</a>
<a href="news.html" class="text-[#4A2A6A] hover:text-[#5c3a8c] font-semibold nav-link">News</a>
<a href="livemap.html" class="text-[#4A2A6A] hover:text-[#5c3a8c] font-semibold nav-link">Live Map</a>
<a href="cityimages.html" class="text-[#4A2A6A] hover:text-[#5c3a8c] font-semibold nav-link">City Images</a>
</div>
<!-- Mobile Menu Button -->
<div class="ml-24 md:hidden flex items-center">
<button
id="menuToggle"
class="text-white focus:outline-none focus:ring-2 focus:ring-white transition"
aria-label="Toggle Menu"
>
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
</svg>
</button>
</div>
</div>
</div>
<!-- Mobile Dropdown Menu -->
<div id="mobileMenu" class="hidden md:hidden bg-[#D29EE8] px-4 py-2 space-y-2">
<a href="weather.html" class="block text-[#4A2A6A] hover:bg-[#5c3a8c] hover:text-white px-2 py-1 rounded">Dashboard</a>
<a href="favoritecities.html" class="block text-[#4A2A6A] hover:bg-[#5c3a8c] hover:text-white px-2 py-1 rounded">Favorite Cities</a>
<a href="searchhistory.html" class="block text-[#4A2A6A] hover:bg-[#5c3a8c] hover:text-white px-2 py-1 rounded">Search History</a>
<a href="news.html" class="block text-[#4A2A6A] hover:bg-[#5c3a8c] hover:text-white px-2 py-1 rounded">News Section</a>
<a href="livemap.html" class="block text-[#4A2A6A] hover:bg-[#5c3a8c] hover:text-white px-2 py-1 rounded">Live Map</a>
<a href="cityimages.html" class="block text-[#4A2A6A] hover:bg-[#5c3a8c] hover:text-white px-2 py-1 rounded">City Images</a>
</div>
</nav>
<div class="relative w-full md:w-1/5 flex items-center max-w-md mx-auto mt-4 md:mt-0">
<input
id="cityInput"
type="text"
placeholder="Enter city name..."
class="w-full px-4 py-2 rounded-l-full border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-800"
/>
<button
id="searchBtn"
class="px-4 py-2 bg-[#4A2A6A] text-white rounded-r-full hover:bg-[#5c3a8c] transition">
Search
</button>
</div>
</header>
<!-- Main Content -->
<main class="transition-all duration-300 p-6 space-y-6">
<!-- Weather Card -->
<div class="flex flex-col md:flex-row gap-6">
<!-- Left Weather Card -->
<div class="w-full sm:w-3/4 md:w-2/3 lg:w-1/2 xl:w-2/5 border border-white rounded-xl shadow-lg p-6 flex justify-between items-center bg-[#D29EE8] relative">
<!-- Weather Details on the Left -->
<div class="flex flex-col space-y-2">
<p id="temperature" class="text-6xl font-bold text-white">27.0°C</p>
<p id="cityName" class="text-2xl font-bold text-white">Surat, IN</p>
<p id="weatherDescription" class="text-lg text-white">Smoke, 12/15/2024</p>
<button
id="favoriteBtn"
class="flex items-center text-white hover:text-purple-800 transition"
onclick="addFavoriteCity(document.getElementById('cityName').textContent.trim())"
>
<svg
id="favoriteIcon"
xmlns="http://www.w3.org/2000/svg"
class="h-5 w-5 mr-1"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"
/>
</svg>
Add to Favorites!
</button>
</div>
<!-- Weather Icon on the Right -->
<div class="hidden md:flex justify-center items-center h-32 w-32 rounded-full bg-gradient-to-br from-purple-100 to-purple-300 shadow-2xl animate-purple-glow">
<img id="weatherIcon" src="" alt="Weather Icon" class="h-16 w-16 opacity-90">
</div>
</div>
<!-- Right Details Card -->
<div class="w-full md:w-1/2 bg-white/40 border border-white rounded-xl shadow-lg p-6 backdrop-blur-lg">
<div class="grid grid-cols-2 gap-4">
<!-- Humidity -->
<div class="flex items-center gap-2">
<img src="assets/humidity-icon.svg" alt="Humidity Icon" class="h-6 w-6 text-blue-400" />
<div>
<p class="text-sm font-semibold text-blue-600">Humidity</p>
<p id="humidity" class="text-xl font-bold text-white">--%</p>
</div>
</div>
<!-- Pressure -->
<div class="flex items-center gap-2">
<img src="assets/pressure-icon.svg" alt="Pressure Icon" class="h-6 w-6 text-indigo-400" />
<div>
<p class="text-sm font-semibold text-indigo-600">Pressure</p>
<p id="pressure" class="text-xl font-bold text-white">-- hPa</p>
</div>
</div>
<!-- Wind Speed -->
<div class="flex items-center gap-2">
<img src="assets/windspeed-icon.svg" alt="Wind Speed Icon" class="h-6 w-6 text-green-400" />
<div>
<p class="text-sm font-semibold text-green-600">Wind Speed</p>
<p id="windSpeed" class="text-xl font-bold text-white">-- m/s</p>
</div>
</div>
<!-- Wind Direction -->
<div class="flex items-center gap-2">
<img src="assets/wind-direction-icon.svg" alt="Wind Direction Icon" class="h-6 w-6 text-teal-400" />
<div>
<p class="text-sm font-semibold text-teal-600">Wind Direction</p>
<p id="windDirection" class="text-xl font-bold text-white">--°</p>
</div>
</div>
<!-- Cloud Coverage -->
<div class="flex items-center gap-2">
<img src="assets/cloud-coverage-icon.svg" alt="Cloud Coverage Icon" class="h-6 w-6 text-gray-400" />
<div>
<p class="text-sm font-semibold text-gray-600">Cloud Coverage</p>
<p id="cloudCoverage" class="text-xl font-bold text-white">--%</p>
</div>
</div>
<!-- Visibility -->
<div class="flex items-center gap-2">
<img src="assets/visibility-icon.svg" alt="Visibility Icon" class="h-6 w-6 text-orange-400" />
<div>
<p class="text-sm font-semibold text-orange-600">Visibility</p>
<p id="visibility" class="text-xl font-bold text-white">-- km</p>
</div>
</div>
<!-- Sunrise -->
<div class="flex items-center gap-2">
<img src="assets/sunrise-icon.svg" alt="Sunrise Icon" class="h-6 w-6 text-yellow-400" />
<div>
<p class="text-sm font-semibold text-yellow-600">Sunrise</p>
<p id="sunrise" class="text-xl font-bold text-white">--:-- AM</p>
</div>
</div>
<!-- Sunset -->
<div class="flex items-center gap-2">
<img src="assets/sunset-icon.svg" alt="Sunset Icon" class="h-6 w-6 text-red-400" />
<div>
<p class="text-sm font-semibold text-red-600">Sunset</p>
<p id="sunset" class="text-xl font-bold text-white">--:-- PM</p>
</div>
</div>
</div>
</div>
</div>
<!-- Weather Graph -->
<div class="bg-white p-6 rounded-xl shadow-lg">
<canvas id="weatherGraph" style="height: 300px; width: 100%;"></canvas> <!-- Fixed height -->
</div>
<div class="bg-[#003E4F] p-6 rounded-lg mb-6">
<!-- Heading Section -->
<h2 class="text-3xl font-bold text-white text-center mb-6">5-Day Weather Forecast</h2>
<!-- Forecast Cards Container -->
<div id="forecastContainer" class="flex justify-between space-x-4 overflow-x-auto">
<!-- Dynamic Forecast Cards will be added here -->
</div>
</div>
</main>
</body>
</html>