Skip to content

Commit 1162136

Browse files
authored
Merge pull request #61 from Abilash-3704/Abilash-HotCold
added animations
2 parents a9151ad + 31e3291 commit 1162136

File tree

2 files changed

+68
-44
lines changed

2 files changed

+68
-44
lines changed

Cold-Hot React/src/SeasonDisplay.css

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,56 @@
11
.icon-left {
2-
position: absolute;
3-
top: 10px;
2+
position: absolute;
3+
top: 10px;
4+
left: 10px;
5+
animation-name: left;
6+
animation-duration: 20s;
7+
animation-iteration-count: infinite;
8+
}
9+
@keyframes left {
10+
0% {
11+
left: 10px;
12+
}
13+
50% {
14+
left: 92%;
15+
}
16+
100% {
417
left: 10px;
18+
}
519
}
620
.icon-right {
7-
position: absolute;
8-
bottom: 10px;
21+
position: absolute;
22+
bottom: 10px;
23+
right: 10px;
24+
animation-name: right;
25+
animation-duration: 20s;
26+
animation-iteration-count: infinite;
27+
}
28+
@keyframes right {
29+
0% {
930
right: 10px;
10-
31+
}
32+
50% {
33+
right: 92%;
34+
}
35+
100% {
36+
right: 10px;
37+
}
1138
}
1239
.season-display.winter i {
13-
color: blue;
40+
color: blue;
1441
}
1542
.season-display.summer i {
16-
color: red;
43+
color: red;
1744
}
1845
.season-display {
19-
display: flex;
20-
justify-content: center;
21-
align-items: center;
22-
height: 100vh;
46+
display: flex;
47+
justify-content: center;
48+
align-items: center;
49+
height: 100vh;
2350
}
2451
.winter {
25-
background-color: aliceblue;
52+
background-color: aliceblue;
2653
}
2754
.summer {
28-
background-color: orange;
29-
}
55+
background-color: orange;
56+
}

Cold-Hot React/src/SeasonDisplay.js

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,31 @@
11
import './SeasonDisplay.css';
2-
import React from "react";
3-
const seasonConfig={
4-
summer: {
5-
text:"Bhai bohot garmi hai",
6-
iconName: "sun"
7-
},
8-
winter: {
9-
text: "Bhai bohot thand hai",
10-
iconName: "snowflake"
11-
}
12-
2+
import React from 'react';
3+
const seasonConfig = {
4+
summer: {
5+
text: 'Bhai bohot garmi hai',
6+
iconName: 'sun',
7+
},
8+
winter: {
9+
text: 'Bhai bohot thand hai',
10+
iconName: 'snowflake',
11+
},
1312
};
14-
const getSeason = (lat,month)=>{
15-
if(month>2 && month<9)
16-
{
17-
return lat > 0 ? 'summer': 'winter';
18-
}else
19-
{
20-
return lat > 0 ? 'winter': 'summer';
21-
}
13+
const getSeason = (lat, month) => {
14+
if (month > 2 && month < 9) {
15+
return lat > 0 ? 'summer' : 'winter';
16+
} else {
17+
return lat > 0 ? 'winter' : 'summer';
18+
}
2219
};
23-
const SeasonDisplay =(props) => {
24-
const season = getSeason(props.lat, new Date().getMonth());
25-
const {text,iconName} =seasonConfig[season];
26-
return(
27-
<div className={`season-display ${season}`}>
28-
<i className={`icon-left massive ${iconName} icon`} />
29-
<h1>{text}</h1>
30-
<i className={`icon-right massive ${iconName} icon`}/>
31-
</div>
32-
);
20+
const SeasonDisplay = props => {
21+
const season = getSeason(props.lat, new Date().getMonth());
22+
const {text, iconName} = seasonConfig[season];
23+
return (
24+
<div className={`season-display ${season}`}>
25+
<i className={`icon-left massive ${iconName} icon`} />
26+
<h1>{text}</h1>
27+
<i className={`icon-right massive ${iconName} icon`} />
28+
</div>
29+
);
3330
};
34-
export default SeasonDisplay;
31+
export default SeasonDisplay;

0 commit comments

Comments
 (0)