-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWeatherApp.jsx
108 lines (100 loc) · 2.85 KB
/
WeatherApp.jsx
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
import React from 'react';
import {
Box,
Heading,
Image,
Button,
VStack,
HStack,
Text,
} from '@chakra-ui/react';
import SunIcon from './SunIcon.jpg';
import CloudIcon from './CloudIcon.png';
import DuckIcon from './Duck.png';
function WeatherApp() {
return (
<Box
w={{ base: "350px", md: "400px" }} // Adjust width for mobile screens
h="700px" // Set appropriate height
bg="#A2C9FA" // Updated back to the old color
borderRadius="xl"
boxShadow="lg"
textAlign="center"
p={6}
position="relative"
mx="auto" // Center the box horizontally
overflow="hidden" // Ensure content stays within the box
>
<Heading fontSize="6xl" color="white">
72°F
</Heading>
{/* Clouds */}
<Image
src={CloudIcon}
alt="cloud"
position="absolute"
top="10%"
left="5%"
boxSize="80px"
/>
<Image
src={CloudIcon}
alt="cloud"
position="absolute"
top="10%"
right="5%"
boxSize="80px"
/>
{/* Weather options */}
<HStack justify="center" mt={8}>
<Button colorScheme="blue" borderRadius="full" px={4} fontSize="sm">
By Hour
</Button>
<Button colorScheme="blue" borderRadius="full" px={4} fontSize="sm">
By Week
</Button>
</HStack>
{/* Hourly weather */}
<HStack spacing={3} justify="center" mt={8}>
{[
{ time: '8am', temp: '72°', icon: SunIcon },
{ time: '9am', temp: '70°', icon: SunIcon },
{ time: '10am', temp: '65°', icon: SunIcon },
{ time: '11am', temp: '64°', icon: SunIcon },
{ time: '12pm', temp: '66°', icon: CloudIcon }, // Added 12pm
].map((item, idx) => (
<VStack key={idx} bg="white" borderRadius="full" p={2} boxShadow="md" minW="60px">
<Image src={item.icon} alt="weather" boxSize="40px" />
<Text fontSize="sm" fontWeight="bold">
{item.time}
</Text>
<Text fontSize="sm">{item.temp}</Text>
</VStack>
))}
</HStack>
<Heading size="xl" mt={10} color="black"> {/* Increased font size */}
New York
</Heading>
<VStack spacing={3} mt={8}>
<Button colorScheme="blue" w="80%" borderRadius="full" fontSize="md" py={2}>
Your Cities
</Button>
<Button colorScheme="blue" w="80%" borderRadius="full" fontSize="md" py={2}>
+ Add City
</Button>
<Button colorScheme="blue" w="80%" borderRadius="full" fontSize="md" py={2}>
See More
</Button>
</VStack>
<Image
src={DuckIcon}
alt="duck"
position="absolute"
bottom="5%"
right="5%"
boxSize="60px"
/>
</Box>
);
}
export default WeatherApp;