File tree Expand file tree Collapse file tree 3 files changed +29
-21
lines changed Expand file tree Collapse file tree 3 files changed +29
-21
lines changed Original file line number Diff line number Diff line change 1
1
{
2
- "env" : {
3
- "browser" : true ,
4
- "es6" : true
5
- },
6
- "extends" : [
7
- " airbnb-base"
8
- ],
9
- "globals" : {
10
- "Atomics" : " readonly" ,
11
- "SharedArrayBuffer" : " readonly"
12
- },
13
- "parserOptions" : {
14
- "ecmaVersion" : 2018 ,
15
- "sourceType" : " module"
16
- },
17
- "rules" : {},
18
- "ignorePatterns" : [
19
- " dist/app.bundle.js" ,
20
- " node_modules/"
21
- ]
22
- }
2
+ "env" : {
3
+ "browser" : true ,
4
+ "es6" : true ,
5
+ "jest" : true
6
+ },
7
+ "parserOptions" : {
8
+ "ecmaVersion" : 2018 ,
9
+ "sourceType" : " module"
10
+ },
11
+ "extends" : [" airbnb-base" ],
12
+ "rules" : {
13
+ "no-shadow" : " off" ,
14
+ "no-param-reassign" : " off" ,
15
+ "eol-last" : " off" ,
16
+ "arrow-parens" : " off"
17
+ },
18
+ "ignorePatterns" : [" dist/app.bundle.js" , " node_modules/" ]
19
+ }
Original file line number Diff line number Diff line change 51
51
font-weight : bolder;
52
52
border : none;
53
53
box-shadow : none;
54
+ }
55
+
56
+ # img-container {
57
+ text-transform : capitalize;
54
58
}
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ async function renderCard(data) {
6
6
const p1 = document . createElement ( 'p' ) ;
7
7
const p2 = document . createElement ( 'p' ) ;
8
8
const parent = document . getElementById ( 'container' ) ;
9
+ const imgCont = document . createElement ( 'div' ) ;
10
+ const img = new Image ( ) ;
9
11
10
12
if ( data . error ) {
11
13
card . className = 'card' ;
@@ -31,12 +33,17 @@ async function renderCard(data) {
31
33
p2 . textContent = `Max: ${ data . main . temp_max } ${ data . units } , Min: ${ data . main . temp_min } ${ data . units } ` ;
32
34
p1 . classList = 'card-text' ;
33
35
p2 . classList = 'card-text' ;
36
+ imgCont . id = 'img-container' ;
37
+ imgCont . textContent = data . weather [ 0 ] . description ;
38
+ img . src = `https://openweathermap.org/img/wn/${ data . weather [ 0 ] . icon } @2x.png` ;
34
39
35
40
card . appendChild ( cardBody ) ;
36
41
cardBody . appendChild ( h5 ) ;
37
42
cardBody . appendChild ( h6 ) ;
38
43
cardBody . appendChild ( p1 ) ;
39
44
cardBody . appendChild ( p2 ) ;
45
+ cardBody . appendChild ( imgCont ) ;
46
+ imgCont . appendChild ( img ) ;
40
47
41
48
if ( parent . lastChild ) {
42
49
parent . removeChild ( parent . lastChild ) ;
You can’t perform that action at this time.
0 commit comments