fix(ui): use small buttons in pagination footer

environments/review-docs-feat-z0hkbz/deployments/20109
upsiflu 2025-01-10 01:14:54 +01:00
rodzic 1ecd8af59f
commit fff04844f9
5 zmienionych plików z 38 dodań i 37 usunięć

Wyświetl plik

@ -16,7 +16,7 @@ const props = defineProps<{
shadow?: boolean shadow?: boolean
round?: boolean round?: boolean
icon?: string icon?: string | `right ${string}`
onClick?: (...args: any[]) => void | Promise<void> onClick?: (...args: any[]) => void | Promise<void>
@ -38,7 +38,6 @@ const fontWeight = props.thinFont ? 400 : 900
const button = ref() const button = ref()
const click = async (...args: any[]) => { const click = async (...args: any[]) => {
internalLoader.value = true internalLoader.value = true
@ -70,12 +69,14 @@ onMounted(() => {
}" }"
@click="click" @click="click"
> >
<i v-if="icon" :class="['bi', icon]" /> <i v-if="icon && !icon.startsWith('right ')" :class="['bi', icon]" />
<span> <span>
<slot /> <slot />
</span> </span>
<i v-if="icon && icon.startsWith('right ')" :class="['bi', icon.replace('right ', '')]" />
<Loader v-if="isLoading" :container="false" /> <Loader v-if="isLoading" :container="false" />
</button> </button>
</template> </template>
@ -94,6 +95,7 @@ onMounted(() => {
white-space: nowrap; white-space: nowrap;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
gap: 10px;
padding: calc(var(--padding) / 2 - var(--shift-by)) var(--padding) calc(var(--padding) / 2 + var(--shift-by)) var(--padding); padding: calc(var(--padding) / 2 - var(--shift-by)) var(--padding) calc(var(--padding) / 2 + var(--shift-by)) var(--padding);
&.is-icon-only { &.is-icon-only {
@ -155,9 +157,6 @@ onMounted(() => {
} }
} }
i.bi + span:not(:empty) {
margin-left: 10px;
}
&.is-icon-only i.bi { &.is-icon-only i.bi {
margin: -6px; margin: -6px;

Wyświetl plik

@ -57,17 +57,15 @@ const setPage = () => {
class="funkwhale pagination" role="navigation"> class="funkwhale pagination" role="navigation">
<ul class="pages"> <ul class="pages">
<li> <li>
<Button @click="page -= 1" :disabled="page <= 1" :aria-label="t('vui.aria.pagination.gotoPrevious')" <Button low-height min-content @click="page -= 1" :disabled="page <= 1" :aria-label="t('vui.aria.pagination.gotoPrevious')"
color="secondary" outline> outline icon="bi-chevron-left">
<i class="bi bi-chevron-left" />
<span v-if="!isSmall">{{ t('vui.pagination.previous') }}</span> <span v-if="!isSmall">{{ t('vui.pagination.previous') }}</span>
</Button> </Button>
</li> </li>
<template v-if="!isSmall"> <template v-if="!isSmall" v-for="(i, index) in renderPages" :key="i">
<template v-for="(i, index) in renderPages" :key="i">
<li> <li>
<Button v-if="i <= pages && i > 0 && pages > 3" @click="page = i" color="secondary" <Button square-small v-if="i <= pages && i > 0 && pages > 3" @click="page = i"
:aria-label="page !== i ? t('vui.aria.pagination.gotoPage', i) : t('vui.aria.pagination.currentPage', page)" :aria-label="page !== i ? t('vui.aria.pagination.gotoPage', i) : t('vui.aria.pagination.currentPage', page)"
:outline="page !== i"> :outline="page !== i">
{{ i }} {{ i }}
@ -75,10 +73,9 @@ const setPage = () => {
</li> </li>
<li v-if="i + 1 < renderPages[index + 1]"></li> <li v-if="i + 1 < renderPages[index + 1]"></li>
</template> </template>
</template>
<template v-else> <template v-else>
<li> <li>
<Button @click="page = 1" color="secondary" <Button square-small @click="page = 1"
:aria-label="page !== 1 ? t('vui.aria.pagination.gotoPage', page) : t('vui.aria.pagination.currentPage', page)" :aria-label="page !== 1 ? t('vui.aria.pagination.gotoPage', page) : t('vui.aria.pagination.currentPage', page)"
:outline="page !== 1"> :outline="page !== 1">
1 1
@ -86,12 +83,12 @@ const setPage = () => {
</li> </li>
<li v-if="page === 1 || page === pages"></li> <li v-if="page === 1 || page === pages"></li>
<li v-else> <li v-else>
<Button color="secondary" :aria-label="t('vui.aria.pagination.currentPage', page)" aria-current="true"> <Button square-small :aria-label="t('vui.aria.pagination.currentPage', page)" aria-current="true">
{{ page }} {{ page }}
</Button> </Button>
</li> </li>
<li> <li>
<Button @click="page = pages" color="secondary" <Button square-small @click="page = pages"
:aria-label="page !== pages ? t('vui.aria.pagination.gotoPage', page) : t('vui.aria.pagination.currentPage', page)" :aria-label="page !== pages ? t('vui.aria.pagination.gotoPage', page) : t('vui.aria.pagination.currentPage', page)"
:outline="page !== pages"> :outline="page !== pages">
{{ pages }} {{ pages }}
@ -100,10 +97,10 @@ const setPage = () => {
</template> </template>
<li> <li>
<Button @click="page += 1" :disabled="page >= pages" :aria-label="t('vui.aria.pagination.gotoNext')" <Button low-height min-content @click="page += 1" :disabled="page >= pages" :aria-label="t('vui.aria.pagination.gotoNext')"
color="secondary" outline> outline icon="right bi-chevron-right">
<span v-if="!isSmall">{{ t('vui.pagination.next') }}</span> <span v-if="!isSmall">{{ t('vui.pagination.next') }}</span>
<i class="bi bi-chevron-right" />
</Button> </Button>
</li> </li>
</ul> </ul>
@ -112,7 +109,7 @@ const setPage = () => {
{{ t('vui.go-to') }} {{ t('vui.go-to') }}
<Input :placeholder="page.toString()" @keyup.enter="setPage" @keydown="preventNonNumeric" <Input :placeholder="page.toString()" @keyup.enter="setPage" @keydown="preventNonNumeric"
inputmode="numeric" pattern="[0-9]* // TODO: Move number input functionality into `Input` component" inputmode="numeric" pattern="[0-9]* // TODO: Move number input functionality into `Input` component"
v-model.number="goTo" /> v-model="goTo" />
</div> </div>
</nav> </nav>
</template> </template>

Wyświetl plik

@ -54,14 +54,6 @@
min-width: 94px; min-width: 94px;
text-align: center; text-align: center;
} }
&:first-child > .funkwhale.button span > span {
padding-left: 0.5ch;
}
&:last-child > .funkwhale.button span > span {
padding-right: 0.5ch;
}
} }
} }

Wyświetl plik

@ -386,10 +386,13 @@ You can override the promise state by passing a false `is-loading` prop.
## Add an icon ## Add an icon
You can use [Bootstrap Icons](https://icons.getbootstrap.com/) in your button component You can use [Bootstrap Icons](https://icons.getbootstrap.com/) in your button component.
::: info ::: info
Icon buttons shrink down to the icon size if you don't pass any content. If you want to keep the button at full width with just an icon, add `width=standard`
- Icon buttons shrink down to the icon size if you don't pass any content. If you want to keep the button at full width with just an icon, add `button-width` as a prop.
- When combining icons with other content, prefix the icon prop with `right ` to place it after the content.
::: :::
```vue-html ```vue-html
@ -399,6 +402,9 @@ Icon buttons shrink down to the icon size if you don't pass any content. If you
<Button destructive icon="bi-trash"> <Button destructive icon="bi-trash">
Delete Delete
</Button> </Button>
<Button low-height icon="right bi-chevron-right">
Next
</Button>
``` ```
<Layout flex> <Layout flex>
@ -408,6 +414,9 @@ Icon buttons shrink down to the icon size if you don't pass any content. If you
<Button destructive icon="bi-trash"> <Button destructive icon="bi-trash">
Delete Delete
</Button> </Button>
<Button low-height icon="right bi-chevron-right">
Next
</Button>
</Layout> </Layout>
## Set width and alignment ## Set width and alignment

Wyświetl plik

@ -6,6 +6,10 @@ import Pagination from "~/components/ui/Pagination.vue"
const page = ref(1) const page = ref(1)
</script> </script>
```ts
import Pagination from "~/components/ui/Pagination.vue"
```
# Pagination # Pagination
The pagination component helps users navigate through large lists of results by splitting them up into pages. The pagination component helps users navigate through large lists of results by splitting them up into pages.