feat: Add skeleton to Home and Sidebar
This commit is contained in:
parent
1265a26c0c
commit
66321e6af7
@ -9,7 +9,10 @@
|
|||||||
<li class="hub-sidebar-item is-title bold text-muted">
|
<li class="hub-sidebar-item is-title bold text-muted">
|
||||||
{{ __('Categories') }}
|
{{ __('Categories') }}
|
||||||
</li>
|
</li>
|
||||||
<li class="hub-sidebar-item" v-for="category in categories" :key="category.label" v-route="category.route">
|
<li v-if="show_skeleton" class="hub-skeleton hub-sidebar-item" v-for="(c, $index) in [1, 2, 3, 4, 5, 6, 7]" :key="$index">
|
||||||
|
Category
|
||||||
|
</li>
|
||||||
|
<li class="hub-sidebar-item" v-else v-for="category in categories" :key="category.label" v-route="category.route">
|
||||||
{{ category.label }}
|
{{ category.label }}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -57,11 +60,14 @@ export default {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
categories: [],
|
categories: [],
|
||||||
|
show_skeleton: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.get_categories()
|
this.get_categories()
|
||||||
.then(categories => {
|
.then(categories => {
|
||||||
|
this.show_skeleton = false;
|
||||||
|
|
||||||
this.categories = categories.map(c => {
|
this.categories = categories.map(c => {
|
||||||
return {
|
return {
|
||||||
label: __(c.name),
|
label: __(c.name),
|
||||||
|
@ -9,7 +9,18 @@
|
|||||||
v-model="search_value"
|
v-model="search_value"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div v-for="section in sections" :key="section.title">
|
<div v-if="show_skeleton">
|
||||||
|
<section-header>
|
||||||
|
<h4 class="hub-skeleton">Explore Explore Explore</h4>
|
||||||
|
</section-header>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3 col-sm-4 col-xs-6 hub-card-container" v-for="(f, $index) in [1, 2, 3, 4, 5, 6, 7]" :key="$index">
|
||||||
|
<div class="hub-skeleton" style="height: 262px; width: 100%; margin-bottom: 25px;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else v-for="section in sections" :key="section.title">
|
||||||
|
|
||||||
<section-header>
|
<section-header>
|
||||||
<h4>{{ section.title }}</h4>
|
<h4>{{ section.title }}</h4>
|
||||||
@ -36,6 +47,7 @@ export default {
|
|||||||
search_value: '',
|
search_value: '',
|
||||||
|
|
||||||
sections: [],
|
sections: [],
|
||||||
|
show_skeleton: true,
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
search_placeholder: __('Search for anything ...'),
|
search_placeholder: __('Search for anything ...'),
|
||||||
@ -52,6 +64,8 @@ export default {
|
|||||||
country: frappe.defaults.get_user_default('country')
|
country: frappe.defaults.get_user_default('country')
|
||||||
})
|
})
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
|
this.show_skeleton = false;
|
||||||
|
|
||||||
this.sections.push({
|
this.sections.push({
|
||||||
title: __('Explore'),
|
title: __('Explore'),
|
||||||
items: data.random_items
|
items: data.random_items
|
||||||
|
Loading…
x
Reference in New Issue
Block a user