Skip to content

Commit

Permalink
Theming With WP REST API - Part 17 - Loading Screens
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Doric committed Jul 1, 2016
1 parent 04b386c commit c39b892
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
4 changes: 4 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

<div class="overlay" v-if="show" transition="overlayshow"></div>

<div class="loading-overlay" v-if="loading">
<div class="loading">Loading...</div>
</div>

<header class="main-header">
<img class="hero" src="<?php bloginfo('template_url'); ?>/images/hero.jpg" alt="">
</header>
Expand Down
7 changes: 6 additions & 1 deletion js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ var postList = Vue.extend({
allPages: '',
prev_page: '',
next_page: '',
currentPage: ''
currentPage: '',
loading: ''
}
},

Expand All @@ -37,9 +38,13 @@ var postList = Vue.extend({

this.currentPage = pageNumber;

this.$set('loading', true);

this.$http.get(posts).then(function(response){
this.$set('posts', response.data);
this.makePagination(response);

this.$set('loading', false);
});
},

Expand Down
19 changes: 18 additions & 1 deletion sass/_homepage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
|--------------------------------------------------------------------------
*/

.overlay{
.overlay, .loading-overlay{
position: fixed;
top:0;
left:0;
Expand All @@ -272,6 +272,23 @@
background: rgba(black, .5);
}



.loading{
width:300px;
background: #000;
text-transform: uppercase;
position: fixed;
font-weight: 700;
color:#fff;
top:50%;
left:50%;
text-align: center;
margin-left: -150px;
margin-top: -10px;
padding:20px;
}

/*
|--------------------------------------------------------------------------
| Pagination
Expand Down
2 changes: 1 addition & 1 deletion style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion style.css.map

Large diffs are not rendered by default.

0 comments on commit c39b892

Please sign in to comment.