-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInfoBox.jsx
52 lines (43 loc) · 2.31 KB
/
InfoBox.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
import Card from '@mui/material/Card';
import CardContent from '@mui/material/CardContent';
import CardMedia from '@mui/material/CardMedia';
import Typography from '@mui/material/Typography';
// import ThunderstormIcon from '@mui/icons-material/Thunderstorm';
// import AcUnitIcon from '@mui/icons-material/AcUnit';
// import WbSunnyIcon from '@mui/icons-material/WbSunny';
import "./InfoBox.css";
export default function InfoBox({info}){
const INIT_URL = "https://images.unsplash.com/photo-1504370805625-d32c54b16100?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTF8fGhvdCUyMHdlYXRoZXJ8ZW58MHx8MHx8fDA%3D";
const HOT_URL ="https://images.unsplash.com/photo-1504370805625-d32c54b16100?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTF8fGhvdCUyMHdlYXRoZXJ8ZW58MHx8MHx8fDA%3D";
const COLD_URL ="https://plus.unsplash.com/premium_photo-1670604649107-a0171e5f1bd0?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MXx8Y29sZCUyMHdlYXRoZXJ8ZW58MHx8MHx8fDA%3D";
const RAIN_URL ="https://plus.unsplash.com/premium_photo-1674684222755-98a35d94cdfa?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MXx8cmFpbiUyMHdlYXRoZXJ8ZW58MHx8MHx8fDA%3D";
return(
<div className="InfoBox">
{/* <h1>WeatherInfo-{info.weather} </h1> */}
<div className='cardContainer'>
<Card sx={{ maxWidth: 345 }}>
<CardMedia
sx={{ height: 140 }}
image={
info.humidity > 80 ? RAIN_URL : info.temp > 15 ? HOT_URL : COLD_URL
}
title="green iguana"
/>
<CardContent>
<Typography gutterBottom variant="h5" component="div">
{info.city}
{/* {info.humidity > 80 ? <ThunderstormIcon/> :info.temp > 15 ? <WbSunnyIcon/> : <AcUnitIcon/>} */}
</Typography>
<Typography variant="body2" color="text.secondary" component={"span"}>
<p>Temperature = {info.temp}°C</p>
<p>Humidity = {info.humidity}</p>
<p> Min Temp = {info.tempMin}°C</p>
<p> Max Temp = {info.tempMax}°C</p>
<p>The weather can be Described as {info.weather} and feels Like {info.feelslike}°C</p>
</Typography>
</CardContent>
</Card>
</div>
</div>
);
}