-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
244 lines (243 loc) · 9.83 KB
/
index.html
File metadata and controls
244 lines (243 loc) · 9.83 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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!--Google Fonts-->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<!--Jost Font-->
<link
href="https://fonts.googleapis.com/css2?family=Jost:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
rel="stylesheet"
/>
<!--Tilt Warp Font-->
<link
href="https://fonts.googleapis.com/css2?family=Tilt+Warp&display=swap"
rel="stylesheet"
/>
<title>Weather App</title>
</head>
<body class="bg-gray-100 font-global">
<div
class="mx-auto 2xl:container min-h-screen flex flex-col justify-center relative"
>
<div
id="weather-app"
class="flex max-2xl:min-h-screen w-full flex-col md:grid md:grid-cols-12 md:grid-rows-layout xl:rounded-3xl shadow-2xl"
>
<!-- Navigation -->
<div
id="navigation"
class="flex items-center justify-between bg-gray-100 py-2 px-4 md:col-start-6 md:col-end-13 md:h-full md:py-4 md:px-8 lg:col-start-5 xl:col-start-4"
>
<div class="flex gap-3">
<button
id="celsiusBtn"
value="metric"
aria-label="Switch to metric unit system"
class="font-title h-10 w-10 rounded-xl [&.active]:bg-black [&.active]:text-white bg-white p-2 shadow hover:shadow-inner"
>
°C
</button>
<button
id="fahrenheitBtn"
value="imperial"
aria-label="Switch to imperial unit system"
class="font-title h-10 w-10 rounded-xl [&.active]:bg-black [&.active]:text-white bg-white p-2 shadow hover:shadow-inner"
>
°F
</button>
</div>
<div class="flex gap-3">
<button
id="themeSwitch"
class="h-10 w-10 rounded-xl bg-white p-2 shadow hover:shadow-inner"
aria-label="Switch to dark theme"
>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="h-6 w-6"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M12 3v2.25m6.364.386l-1.591 1.591M21 12h-2.25m-.386 6.364l-1.591-1.591M12 18.75V21m-4.773-4.227l-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z"
/>
</svg>
</button>
<div id="user-avatar" class="h-10 w-10">
<img
src="https://randomuser.me/api/portraits/men/40.jpg"
alt="User Avatar"
class="rounded-xl border-2 border-white shadow hover:border-gray-200 hover:shadow-inner"
/>
</div>
</div>
</div>
<!-- Main info -->
<div
id="weather-main-info"
class="col-span-3 row-span-full flex py-4 px-4 md:px-8 flex-grow flex-col bg-white md:col-start-1 md:col-end-6 lg:col-end-5 xl:col-end-4 xl:rounded-tl-3xl xl:rounded-bl-3xl"
>
<div id="search" class="mb-4 md:py-2 md:px-4 flex">
<input
id="input"
type="text"
placeholder="Search by city, postcode,..."
class="text-lg w-full h-12 font-title p-2"
/>
<button id="submit" type="button" class="p-2">
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="w-6 h-6"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"
/>
</svg>
</button>
</div>
<div
id="weather-details"
class="flex flex-grow max-md:flex-wrap gap-6 md:flex-col md:flex-grow-0 mb-3"
>
<div class="flex flex-col justify-between gap-2">
<div class="flex gap-2 flex-row md:gap-4">
<span id="temp">
<span class="text-6xl md:text-8xl" data-value="">0</span
><span data-unit="">°C</span>
</span>
<div id="icon" class="md:w-3/4 max-w-[12rem]"></div>
</div>
<div class="flex items-center gap-2">
<span id="temp-min"
>min.<span class="text-lg ml-1" data-value>0</span
><span data-unit>°C</span></span
>
<span class="mx-1 border-r-2 h-3/4"></span>
<span id="temp-max"
>max.<span class="text-lg ml-1" data-value>0</span
><span data-unit>°C</span></span
>
</div>
</div>
<div class="flex-grow">
<div id="last-update" class="w-3/4 md:text-lg font-title">
<span data-value="">Sunday, 10:00</span>
</div>
<div class="w-4/5 my-2 md:my-4 border-bottom border-b-2"></div>
<div id="clouds" class="w-3/4 md:text-lg font-title">
<span data-value>Mostly cloudy</span>
</div>
<div id="rain" class="w-3/4 md:text-lg">
Rain - <span data-value="">0</span>%
</div>
<div class="w-4/5 my-2 md:my-4 border-bottom border-b-2"></div>
<div id="city" class="w-3/4 md:text-lg font-medium">
<span data-value></span>
</div>
</div>
</div>
<div class="w-full h-24 mb-3 relative flex-grow md:h-auto md:my-0">
<img
class="w-full h-full object-cover rounded-3xl"
src="https://images.pexels.com/photos/39003/scotland-united-kingdom-england-isle-of-skye-39003.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1"
width="128"
height="96"
/>
<div
class="w-full h-full rounded-3xl absolute bg-gray-100 opacity-20 top-0 left-0"
></div>
</div>
</div>
<!-- Side info -->
<div
id="weather-side-info"
class="flex flex-col py-2 px-4 md:py-4 md:px-8 md:col-start-6 md:col-end-13 lg:col-start-5 xl:col-start-4"
>
<p class="col-span-full text-xl my-2 font-title">
3 Day / 3 Hour Forecast
</p>
<div class="w-full my-5 relative overflow-hidden">
<div
id="forecast"
class="flex justify-between min-w-full w-fit cursor-pointer touch-none"
></div>
</div>
<div class="grow"></div>
<p class="col-span-full text-xl my-2 font-title">
Today's Highlights
</p>
<div class="grid grid-cols-2 lg:grid-cols-3 gap-3">
<div id="humidity" class="info-card">
<p class="text-slate-400">Humidity</p>
<div class="py-4">
<span class="text-4xl mr-1" data-value>0</span>
<span data-unit>%</span>
</div>
<p class="text-slate-400" data-desc>Description</p>
</div>
<div id="pressure" class="info-card">
<p class="text-slate-400">Pressure</p>
<div class="py-4">
<span class="text-4xl mr-1" data-value>0</span
><span class="" data-unit>hPa</span>
</div>
<p class="text-slate-400" data-desc>Description</p>
</div>
<div id="wind" class="info-card">
<p class="text-slate-400">Wind</p>
<div class="py-4">
<span class="text-4xl mr-1" data-value>0</span
><span class="" data-unit>km/h</span>
</div>
<p class="text-slate-400" data-desc>Description</p>
</div>
<div id="visibility" class="info-card">
<p class="text-slate-400">Visibility</p>
<div class="py-4">
<span class="text-4xl mr-1" data-value>0</span
><span class="" data-unit>km</span>
</div>
<p class="text-slate-400" data-desc>Description</p>
</div>
<div id="daytimes" class="info-card">
<p class="text-slate-400">Sunrise & Sunset</p>
<div class="flex flex-col flex-wrap justify-between py-4">
<span id="sunrise"
><span class="mr-1">↑</span
><span class="text-2xl" data-value>00:00</span></span
><span id="sunset"
><span class="mr-1">↓</span
><span class="text-2xl" data-value>00:00</span></span
>
</div>
<p class="text-slate-400" data-desc>Description</p>
</div>
<div id="feels-like" class="info-card">
<p class="text-slate-400">Feels like</p>
<div class="py-4">
<span class="text-4xl mr-1" data-value>0</span>
<span data-unit>°C</span>
</div>
<p class="text-slate-400" data-desc>Description</p>
</div>
</div>
</div>
</div>
</div>
<script type="module" src="/src/main.js"></script>
</body>
</html>