File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed
Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,11 @@ fetch('http://localhost:8001/fetch', {
1111 }
1212} ) . then ( function ( data ) {
1313 // This is the JSON from our response
14+ newsFromApi = document . getElementById ( "news-from-api" )
15+ loading = document . getElementById ( "news-from-api-loading" )
16+
17+ newsFromApi . removeChild ( loading )
18+
1419 for ( i in data [ 'headlines' ] ) {
1520 let htmlstring = `
1621 <div class="card-body">
@@ -25,10 +30,9 @@ fetch('http://localhost:8001/fetch', {
2530 `
2631 let div = document . createElement ( 'div' )
2732 div . innerHTML = htmlstring . trim ( )
28- div . className = "card col-sm-3 m-2"
29- div . style = "max-width: 15rem;"
33+ div . className = "card col-lg-3 col-md-4 col-sm-6"
3034
31- document . getElementById ( "news-from-api" ) . appendChild ( div )
35+ newsFromApi . appendChild ( div )
3236 if ( i == 11 ) break
3337 }
3438 console . log ( data ) ;
Original file line number Diff line number Diff line change @@ -170,9 +170,17 @@ <h5 class="card-title">Pymetaheuristics</h5>
170170 </ div >
171171 </ div >
172172
173- < div id ="news-from-api " class ="row d-flex justify-content-between "> </ div >
173+ < div id ="news-from-api " class ="row d-flex justify-content-between mx-0 ">
174+ < div id ="news-from-api-loading " class ="d-flex justify-content-center ">
175+ < div class ="spinner-border text-secondary " style ="width: 4rem; height: 4rem; " role ="status ">
176+ < span class ="visually-hidden "> Loading...</ span >
177+ </ div >
178+ </ div >
179+ </ div >
174180 </ div >
175- < div class ="d-flex justify-content-center my-3 ">
181+
182+ <!-- Back to top -->
183+ < div class ="d-flex justify-content-center my-5 ">
176184 < a class ="btn btn-seconday " role ="button " href ="# ">
177185 < svg xmlns ="http://www.w3.org/2000/svg " width ="32 " height ="32 " fill ="currentColor " class ="bi bi-arrow-up-circle-fill " viewBox ="0 0 16 16 ">
178186 < path d ="M16 8A8 8 0 1 0 0 8a8 8 0 0 0 16 0zm-7.5 3.5a.5.5 0 0 1-1 0V5.707L5.354 7.854a.5.5 0 1 1-.708-.708l3-3a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 5.707V11.5z "/>
You can’t perform that action at this time.
0 commit comments