-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
115 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<template lang=""> | ||
<div class="flex items-center justify-center" v-if="props.totalItems > 0"> | ||
<vue-awesome-paginate | ||
:total-items="props.totalItems" | ||
:items-per-page="props.perpage" | ||
:max-pages-shown="5" | ||
v-model="page" | ||
:on-click="onClickHandler" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import router from "@/router"; | ||
import { ref, watch } from "vue"; | ||
import { useRoute } from 'vue-router'; | ||
const route = useRoute(); | ||
const props = defineProps({ | ||
perPage: { | ||
type: Number, | ||
required: true, | ||
}, | ||
totalItems: { | ||
type: Number, | ||
required: true, | ||
}, | ||
currentPage: { | ||
type: Number, | ||
required: true, | ||
} | ||
}); | ||
const onClickHandler = (page) => { | ||
const classId = route.params.classId; | ||
router.push({ name: "exercise", params: { classId }, query: { | ||
page, | ||
}}) | ||
}; | ||
const page = ref(1); | ||
watch(() => props.currentPage, () => { | ||
page.value = props.currentPage; | ||
},{ immediate: true }) | ||
</script> | ||
|
||
<style> | ||
.pagination-container { | ||
display: flex; | ||
column-gap: 10px; | ||
} | ||
.paginate-buttons { | ||
height: 40px; | ||
width: 40px; | ||
border-radius: 20px; | ||
cursor: pointer; | ||
background-color: rgb(242, 242, 242); | ||
border: 1px solid rgb(217, 217, 217); | ||
color: black; | ||
} | ||
.paginate-buttons:hover { | ||
background-color: #d8d8d8; | ||
} | ||
.active-page { | ||
background-color: #3498db; | ||
border: 1px solid #3498db; | ||
color: white; | ||
} | ||
.active-page:hover { | ||
background-color: #2988c8; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,33 @@ | ||
<template lang=""> | ||
<div> | ||
<Box | ||
v-for="exam in exams.data" | ||
v-for="exam in props.exams.data" | ||
:key="exam.slug" | ||
:name="exam.name" | ||
:avatar="exam.avatar" | ||
:description="exam.description || exam.meta_description" | ||
/> | ||
|
||
<custom-pagination | ||
:per-page="props.exams.per_page" | ||
:total-items="props.exams.total" | ||
:current-page="props.currentPage" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import Box from "@/components/Box.vue"; | ||
import CustomPagination from "@/components/CustomPagination.vue"; | ||
const props = defineProps({ | ||
exams: { | ||
type: Object, | ||
required: true, | ||
}, | ||
currentPage: { | ||
type: Number, | ||
required: true, | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters