-
Notifications
You must be signed in to change notification settings - Fork 882
[EuiPagination] Hide of text on small screens
#4661
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
Merged
elizabetdev
merged 9 commits into
elastic:master
from
elizabetdev:pagination-hide-when-compressed
Mar 30, 2021
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e12e4c2
Hid `of` text on small screens
elizabetdev 47363b2
Adding CL
elizabetdev 0fa7b93
Merge remote-tracking branch 'upstream/master' into pagination-hide-w…
elizabetdev 51c757f
Moving CL to bug fixes section
elizabetdev b8d3275
Changing pagination button to S
elizabetdev ebfa3e3
Tests
elizabetdev a47c854
Adding line break
elizabetdev 474f22c
Update src/components/pagination/_pagination.scss
elizabetdev 10eae95
Merge branch 'pagination-hide-when-compressed' of https://github.com/…
elizabetdev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ import { EuiPaginationButton } from './pagination_button'; | |
| import { EuiButtonIcon } from '../button'; | ||
| import { EuiI18n } from '../i18n'; | ||
| import { EuiText } from '../text'; | ||
| import { EuiHideFor } from '../responsive'; | ||
|
|
||
| const MAX_VISIBLE_PAGES = 5; | ||
| const NUMBER_SURROUNDING_PAGES = Math.floor(MAX_VISIBLE_PAGES * 0.5); | ||
|
|
@@ -250,26 +251,30 @@ export const EuiPagination: FunctionComponent<Props> = ({ | |
| ); | ||
|
|
||
| const selectablePages = pages; | ||
|
|
||
| if (compressed) { | ||
| const firstPageButtonCompressed = ( | ||
| <PaginationButton pageIndex={activePage} inList={false} /> | ||
| ); | ||
| const lastPageButtonCompressed = ( | ||
| <PaginationButton pageIndex={pageCount - 1} inList={false} /> | ||
| ); | ||
|
|
||
| return ( | ||
| <nav className={classes} {...rest}> | ||
| {previousButton} | ||
| <EuiText size="s" className="euiPagination__compressedText"> | ||
| <EuiI18n | ||
| token="euiPagination.pageOfTotalCompressed" | ||
| default="{page} of {total}" | ||
| values={{ | ||
| page: firstPageButtonCompressed, | ||
| total: lastPageButtonCompressed, | ||
| }} | ||
| /> | ||
| </EuiText> | ||
| <EuiHideFor sizes={['xs', 's']}> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! This may even open it up for consumers to be able to customize these breakpoint sizes ❤️ |
||
| <EuiText size="s" className="euiPagination__compressedText"> | ||
| <EuiI18n | ||
| token="euiPagination.pageOfTotalCompressed" | ||
| default="{page} of {total}" | ||
| values={{ | ||
| page: firstPageButtonCompressed, | ||
| total: lastPageButtonCompressed, | ||
| }} | ||
| /> | ||
| </EuiText> | ||
| </EuiHideFor> | ||
| {nextButton} | ||
| </nav> | ||
| ); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.