Files
FabledScribe/frontend/src/components/PaginationBar.vue
T
bvandeusenandClaude Opus 5 4c9a637507
CI & Build / Python lint (push) Successful in 4s
CI & Build / Plugin hooks (push) Successful in 13s
CI & Build / integration (push) Successful in 29s
CI & Build / TypeScript typecheck (push) Successful in 33s
CI & Build / Python tests (push) Successful in 55s
CI & Build / Build & push image (push) Successful in 41s
fix(theme): text on a filled colour needs its own token — the old one inverts
76 hardcoded `color: #fff` now resolve to --fs-text-on-action, a new token
that is parchment in BOTH modes.

The design system said they should supersede to --fs-text-primary, on the
recorded reasoning that "there is no 'text on action' colour, there is just the
text colour." That is true on dark and wrong on light. --fs-text-primary
inverts to #14171A; the surfaces underneath it do not invert at all — every one
of these 76 sits on an action colour, a semantic colour, the accent, or the CTA
gradient, all of which hold a single value across modes.

Sweeping as recorded would have put obsidian text on moss green: roughly 2.4:1,
against a house style whose stated floor is WCAG AA. It would have looked
correct to me, because I checked it in the mode where it was correct.

--color-accent-fg had the same defect independently and is repointed too.

The token check now reports zero superseded literals, down from 30 files, and
raw colour literals drop 246 -> 169.

Closes #2275.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UaYUaouG9jjhATyuxCKrQs
2026-07-31 22:40:58 -04:00

101 lines
2.2 KiB
Vue

<script setup lang="ts">
import { computed } from "vue";
const props = defineProps<{
total: number;
limit: number;
offset: number;
}>();
const emit = defineEmits<{
"update:offset": [offset: number];
}>();
const totalPages = computed(() => Math.ceil(props.total / props.limit) || 1);
const currentPage = computed(() => Math.floor(props.offset / props.limit) + 1);
const pages = computed(() => {
const total = totalPages.value;
const current = currentPage.value;
const result: (number | "...")[] = [];
for (let i = 1; i <= total; i++) {
if (i === 1 || i === total || (i >= current - 1 && i <= current + 1)) {
result.push(i);
} else if (result[result.length - 1] !== "...") {
result.push("...");
}
}
return result;
});
function goToPage(page: number) {
emit("update:offset", (page - 1) * props.limit);
}
</script>
<template>
<div v-if="totalPages > 1" class="pagination">
<button
class="page-btn"
:disabled="currentPage === 1"
@click="goToPage(currentPage - 1)"
>
Prev
</button>
<template v-for="(page, idx) in pages" :key="idx">
<span v-if="page === '...'" class="ellipsis">...</span>
<button
v-else
class="page-btn"
:class="{ active: page === currentPage }"
@click="goToPage(page as number)"
>
{{ page }}
</button>
</template>
<button
class="page-btn"
:disabled="currentPage === totalPages"
@click="goToPage(currentPage + 1)"
>
Next
</button>
</div>
</template>
<style scoped>
.pagination {
display: flex;
align-items: center;
justify-content: center;
gap: 0.25rem;
margin-top: 1.5rem;
}
.page-btn {
padding: 0.35rem 0.7rem;
border: 1px solid var(--color-border);
border-radius: var(--radius-sm);
background: var(--color-bg-card);
color: var(--color-text);
cursor: pointer;
font-size: 0.85rem;
}
.page-btn:hover:not(:disabled) {
background: var(--color-bg-secondary);
}
.page-btn:disabled {
opacity: 0.4;
cursor: default;
}
.page-btn.active {
background: var(--color-primary);
color: var(--fs-text-on-action);
border-color: var(--color-primary);
}
.ellipsis {
padding: 0 0.25rem;
color: var(--color-text-muted);
}
</style>