Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix loading issue more info #140

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion src/client/components/measure-list/measure-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@

<ul class="measure-list__list">
<li
v-for="measure in filteredMeasures"
v-for="measure in paginatedMeasures"
:key="measure.id"
class="measure-list__item"
>
Expand All @@ -134,6 +134,18 @@
/>
</li>
</ul>
<ul v-if="totalPages > 1" class="measure-list__pagination-list">
<li v-for="i in totalPages" :key="i">
<md-button
:class="{'md-raised': true, 'md-accent': i === page}"
@click="page = i"
@keydown="page = i"
>
{{ i }}
</md-button>
</li>
<ul />
</ul>
</div>
</template>

Expand All @@ -159,6 +171,8 @@ export default {
searchValue: '',
sortType: SYSTEM_SUITABILITY,
sorting: ['featured'],
page: 1,
perPage: 16,
}),
computed: {
...mapState({
Expand Down Expand Up @@ -229,6 +243,25 @@ export default {

return searchFiltered(this.featureSorted)
},
totalPages() {
return Math.ceil(this.filteredMeasures.length / this.perPage)
},
paginatedMeasures() {
const start = (this.page - 1) * this.perPage
const end = start + this.perPage
return [...this.filteredMeasures].slice(start, end)
},
},
watch: {
searchValue() {
this.page = 1
},
sortType() {
this.page = 1
},
sorting() {
this.page = 1
},
},
methods: {
choose(value) {
Expand Down Expand Up @@ -260,6 +293,12 @@ export default {
padding: var(--spacing-default);
}

.measure-list__pagination-list {
list-style: none;
display: flex;
justify-content: center;
}

.measure-list__card {
height: 100%;
}
Expand Down