Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
Tommytrg committed Sep 3, 2024
1 parent 3d686d5 commit 101eb2c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/components/Button/AnimatedArrow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const props = defineProps({
},
color: {
type: String,
default: "#fff"
default: '#fff'
}
})
Expand Down
5 changes: 2 additions & 3 deletions src/components/icon/WIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const props = defineProps({
},
color: {
type: String,
default: "#232323"
default: '#232323'
}
})
Expand All @@ -43,8 +43,7 @@ const iconComponent = computed(() => {
</script>

<style lang="scss" scoped>
:deep(path) {
fill: v-bind(color);
}
</style>
</style>
7 changes: 5 additions & 2 deletions src/components/pagination/WPagination.stories.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from '@storybook/vue3'
import { ref, watch } from 'vue'

Check warning on line 2 in src/components/pagination/WPagination.stories.ts

View workflow job for this annotation

GitHub Actions / cache-and-install

'watch' is defined but never used
import WPagination from './WPagination.vue'

const meta = {
Expand All @@ -16,9 +17,11 @@ export const Default: Story = {
render: (args) => ({
components: { WPagination },
setup() {
return { args }
const page = ref(args.page)

return { args, page }
},
template: `<WPagination v-bind="args" />`
template: `<WPagination v-bind="args" v-model:page="page" />`
}),
args: {
page: 1,
Expand Down
31 changes: 7 additions & 24 deletions src/components/pagination/WPagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
:key="p"
type="button"
class="min-h-[38px] min-w-[38px] flex justify-center items-center hover:bg-wit-blue-400 py-sm px-sm text-sm rounded-lg"
@click="updatePage(p)"
:class="{
'outline-none': p === page,
'bg-wit-blue-500': p === page,
Expand Down Expand Up @@ -82,42 +83,24 @@ const props = defineProps({
type: Number,
required: true
},
page: {
type: Number,
required: true
},
pageSize: {
type: Number,
required: true
},
onPageChange: {
type: Function
},
onPageSizeChange: {
type: Function
},
onPageCountChange: {
type: Function
}
})
const emit = defineEmits(['page-change', 'page-size-change', 'page-count-change'])
const page = defineModel<number>('page')
function updatePage(newPage: number) {
page.value = newPage
}
const data = computed(() => {
// avoid different pagination type: UseOffsetPaginationInfinityPageReturn
const pagination: UseOffsetPaginationReturn = useOffsetPagination({
...props,
onPageChange(...args) {
props.onPageChange?.(...args)
emit('page-change', ...args)
},
onPageSizeChange(...args) {
props.onPageSizeChange?.(...args)
emit('page-size-change', ...args)
},
onPageCountChange(...args) {
props.onPageCountChange?.(...args)
emit('page-count-change', ...args)
updatePage(args[0].currentPage)
}
} as UseOffsetPaginationOptions) as UseOffsetPaginationReturn
Expand Down

0 comments on commit 101eb2c

Please sign in to comment.