Skip to content
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

USWDS - Pagination: Update pagination on develop. #4175

Merged
merged 120 commits into from
Jun 16, 2021
Merged

Conversation

mejiaj
Copy link
Contributor

@mejiaj mejiaj commented Apr 28, 2021

Description

Preview links

Settings

Setting Description
$theme-pagination-background-color The background color of the entire pagination component
$theme-pagination-breakpoint Breakpoint at which full pager displays
$theme-pagination-button-background-color Pager button background color
$theme-pagination-button-border-color Default pager button border
$theme-pagination-button-border-radius Button roundness
$theme-pagination-button-border-width Width of the button border
$theme-pagination-current-background-color Background color of current page
$theme-pagination-font-family Font family for entire component
$theme-pagination-margin-x Horizontal spacing between elements
$theme-pagination-margin-y Vertical spacing above/below component
$theme-pagination-min-width Minimum width of pager buttons
$theme-pagination-padding Inner spacing of the buttons
$theme-pagination-pager-color removed

Two new variables:

  • $theme-pagination-background-color required for accessible color setting
  • $theme-pagination-current-background-color option for user to set current page background
  • $theme-pagination-font-family font family for entire component

Additional information

  • Added a prettier:templates task to cleanup rendered templates on USWDS-Site.
  • Created partials to cleanup template:
    • _pagination-arrow.njk
    • _pagination-button.njk
    • _pagination-numbers--default
    • _pagination-numbers--infinite
  • Added Spanish variants
  • Removed pagination test on usa-section-dark

Also closes #4158.

06/04/21

Updated logic for bounded sets. See commit c9eb3f5 for more details.

Related PRs

Part of uswds/uswds-site/pull/1218.

Guidance PR→

PR for adding this to library beta.


Before you hit Submit, make sure you’ve done whichever of these applies to you:

  • Follow the 18F Front End Coding Style Guide and Accessibility Guide.
  • Run npm test and make sure the tests for the files you have changed have passed.
  • Run your code through HTML_CodeSniffer and make sure it’s error free.
  • Title your pull request using this format: [Website] - [UI component]: Brief statement describing what this pull request solves.

mejiaj and others added 30 commits December 7, 2020 12:47
- Add config file
- Add template with sample markup
- Start basic theming
- Create a pagination link macro to set markup based on current item
- Add pagination config for total # of items and to set active item
Checks for the following cases:
- Few items w/ varying items selected
- Lots of items w/ varying items selected
- White background (default)
- Gray background (usa-section--light)
- Dark background (usa-section--dark)
Pagination items are now in a switch case statement with 3 checks, rather than a bunch of `if` statements.

We now check for 3 simple conditions:
- Few items (less than 4)
- One of last four selected (last four)
- Default current selected + sibling and last two total pages
2 new settings:
1. `$theme-pagination-pager-color` —  Pagination item link color
1. `$theme-pagination-min-width` — Minimum width of pagination item

- Use tabular numbers to get more consistent spacing
- Force link color so it works on dark backgrounds
- Remove text selection from ellipsis
- Update number of items shown by default
  - Always show first
  - Always show last
  - If less than 4 show all 4
  - If greater than or equal to last 4 show all
  - By default (if more than 4) show current, current - 1, and current + 1
- Add more ellipsis between items
- Remove label
- Move prev/next arrows to end of template
- Set pagination current as a link so it's focusable
- Added margin-x setting
- Increased margin-y
- Moved pager button styles to and extend `%pagination-button-styles`
- Removed button styles from ellipsis
- Moved chevrons out of pager nav
- Added `!important` shim to `set-text-and-bg` mixin
@thisisdano
Copy link
Member

Good to merge after you split out the demo. Nice work!

@thisisdano thisisdano merged commit 8f62a67 into develop Jun 16, 2021
@thisisdano thisisdano deleted the jm-add-pagination branch June 16, 2021 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Spanish version of pagination component
2 participants