Skip to content

Commit

Permalink
Change metric -> criterion
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter York committed Jan 16, 2025
1 parent 739fa76 commit 74761d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions src/lib/PrevNext.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@
export let total: number;
export let urlPath: string;
export let startIdx = 1;
export let questionType: string = "metric";
function formatIndex(idx: number): string {
return (idx + startIdx - 1).toString().padStart(2, "0");
}
function capitaliseFirstCharacter(string: string) {
return string.charAt(0).toUpperCase() + string.slice(1);;
}
</script>

<nav
Expand Down Expand Up @@ -36,7 +41,9 @@
d="m6.5938-0.0078125-6.7266 6.7266 6.7441 6.4062 1.377-1.449-4.1856-3.9768h12.896v-2h-12.984l4.2931-4.293-1.414-1.414z"
></path>
</svg>
<span class="govuk-pagination__link-title">Previous metric</span>
<span class="govuk-pagination__link-title">
Previous {questionType}
</span>
</a>
</div>
{:else}
Expand All @@ -45,7 +52,8 @@

<ul class="govuk-pagination__list">
<li class="govuk-pagination__item">
Metric {idx} / {total}
{capitaliseFirstCharacter(questionType)}
{idx} / {total}
</li>
</ul>

Expand All @@ -56,7 +64,7 @@
href="{base}/{urlPath}{formatIndex(idx + 1)}"
rel="next"
>
<span class="govuk-pagination__link-title">Next metric</span>
<span class="govuk-pagination__link-title">Next {questionType}</span>
<svg
class="govuk-pagination__icon govuk-pagination__icon--next"
xmlns="http://www.w3.org/2000/svg"
Expand Down
2 changes: 1 addition & 1 deletion src/routes/planning/assessment/Question.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</div>

<div class="govuk-grid-column-three-quarters">
<PrevNext {idx} total={10} urlPath="planning/assessment/q" />
<PrevNext {idx} total={10} urlPath="planning/assessment/q" questionType="Criterion" />

<slot name="description" />

Expand Down

0 comments on commit 74761d0

Please sign in to comment.