-
Notifications
You must be signed in to change notification settings - Fork 117
Update pagination component to add new numbered pages variant #1026
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Is there an opportunity for us to follow the GOV.UK decision here? My spidey sense is that using a list item for the now and next page items, inside a navigation landmark labelled pagination, is misleading (there may be more than 2 pages, its just that only the previous and next ones have been linked to). Further more, if you have numbered pagination with say 3 items, it’ll be announced in a list having 5 items. Which is to say, I think the distinction between those links that appear in a list, and those used for previous and next links, is an important one.
How compatible with the GOV.UK markup would this component be, say if you were using – entirely hypothetically you understand – a GOV.UK-based component library that allowed you to use NHS styles by changing class prefixes from Separately, see #1027; from both wanting visual consistency, and being able to identify the pagination arrows at these smaller sizes, the existing pagination arrows should have open tips. |
Ah sorry, I didn’t explain this well enough. I’ve followed the GOVUK markup for the new 'numbered pages' variant. This means that the numbers are within a What I’ve not done is changed the markup used for the existing 'previous and next links with page titles' variant, which uses this markup in the NHS version: <nav><ul>
<li><a href="#">Previous: page title</a></li>
<li><a href="#">Next: page title</a></li>
</ul></nav> but this in the GOV.UK version: <nav>
<a href="#">Previous: page title</a>
<a href="#">Next: page title</a>
</nav> ( Possibly we should also update this to match the GOV.UK version, but possibly the
Right now the markup for the new numbered pages variant should be mostly compatible except for the SVG for the arrows, which is different. There might also be some other differences in the css names. |
This adds a pagination component to the bottom of the Manage users page, rather than just displaying all users on a single page. The number of users per page is set at 20, although this could be tweaked. The pagination component is not yet part of the NHS design system, so I’ve borrowed the GOV.UK one and applied NHS styling. This is still work-in-progress, and I’m working on contributing this to the NHS design system here: nhsuk/nhsuk-frontend#1026 ## Screenshots ### Manage users | First page | Middle page | Last page | | ------ | ------ | ------ | |  |  |  | ### Vaccine batches (on vaccine product page for a given site)  If there are a lot of pages, then ellipsis would be used to show gaps in the sequence, so that the first page, last page, previous and next page are always included: <img width="608" alt="Screenshot 2024-09-23 at 16 09 43" src="https://github.com/user-attachments/assets/500b8dfd-2ecc-4f69-b8a4-3078642a1fbe">
|
How can we hide (not show) the 'Previous' link when users are on the first page AND "Next" link when users are on the last page? Our user research revealed that participants were confused about what the 'Previous' link would do when they're already on page 1. Similarly, users expect the 'Next' link to be disabled when they reach the last page. This feedback suggests we need to implement hide states for pagination controls to provide clearer visual cues about available navigation options. |
@Arpana18 Hiya - the previous and next links are only shown when specified in the HTML or in the |
@colinrotherham @paulrobertlloyd I've updated this from main and fixed the conflicts and deprecations (I think). Next step is to sort out the mobile view. Follow GOVUK and go centre aligned, with 'Previous' stacked above the numbers and 'Next' stacked below? |
I'd say so, but only in the absence of a better (researched) option. For comparison we could look at ideas in: |
d0dd372
to
82c26a9
Compare
Sorry about the force push @frankieroberto I've removed all the link style overrides so the defaults are now used, including ![]() Would be good to chat about the A few of the default styles were causing conflicts without it (e.g. stretching link |
ceef42c
to
669439a
Compare
Sorry about the force push again, 639 commits added and macro options are now ES modules |
Merged with latest |
@colinrotherham I'm planning to pick this up again later this week, as it a component desperately needed by my service. But this would be a v11 thing. |
527cf90
to
fa7bfa2
Compare
Updated with |
|
fa7bfa2
to
1337f55
Compare
Fixed all the conflicts to bring in:
|
|
Okay I’ve updated this, with the main aim of making this now backwards-compatible, so that it is no longer a breaking change. The downside of this is that it remains un-aligned with the govuk frontend one at both the macro level and the HTML output is also slightly different (especially for the existing variant), but I’ve made it as compatible as I can. The use of the nested We could still decide to deprecate Still got a bit of fiddling to do on the design and the mobile-responsiveness, but getting closer... |
Have a look from line 6? I had to do some wrangling to make the GOV.UK Frontend object syntax for prefix/suffix work with our strings But it worked. Old and new API, If that opens any doorways for you? |
@colinrotherham yeah, I was considering doing similar to support both For now, I’ll focus on the remaining design tasks. |
This updates Pagination component to support a new variant which is suitable for paging between numbered lists of pages, for example in search results or a long list of patients or appointments.
The variant is based on the GOV.UK Pagination variant, but with a few changes to match NHS styling, and some differences in the macro params.
The component is backwards-compatible, so the existing previous and next pagination variant is unchanged.
TODO