BUILDING INFO BOX
HERE, WE USE A CARD LAYOUT TO SHOW THE INFO . FROM THE MATERIAL UI WE IMPORT THE REQUIRED CODE.
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 "./InfoBox.css"
export default function InfoBox() {
let info = {
city: "khammam",
feels_like: 34.48,
humidity: 26,
temp: 35.43,
tempMax: 35.43,
tempMin: 35.43,
weather: "clear sky",
};
return (
<div className="InfoBox">
<h1>Weather info - {info.weather}</h1>
<Card sx={{ maxWidth: 345 }}>
<CardMedia
sx={{ height: 140 }}
image="https://images.unsplash.com/photo-1603883055407-968560f7522e?q=80&w=1901&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
title="green iguana"
/>
<CardContent>
<Typography gutterBottom variant="h5" component="div">
<p> {info.city}</p>
</Typography>
<Typography variant="body2" sx={{ color: "text.secondary" }} component={"span"}>
<p> Humidity:{info.humidity}</p>
<p>Temperature: {info.temp}°C(TO SHOW THE DEGREE SYMBOL)</p>
<p> Min Temp: {info.tempMin}°C</p>
<p> Max Temp: {info.tempMax}°C</p>
<p>
Weather can be described as <i>{info.weather}</i> but it feels
like {info.feels_like} °C
</p>
</Typography>
</CardContent>
</Card>
</div>
);
}

Comments
Post a Comment