Skip to content

Commit 26a3a09

Browse files
authored
chore(pagination): rename Navigation to PaginationNavigation (patternfly#11664)
* chore(pagination): rename Navigation to PaginationNavigation * renamed test file * rename navigation props and state
1 parent 5dd8f3e commit 26a3a09

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

packages/react-core/src/components/Pagination/Pagination.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ToggleTemplate, PaginationToggleTemplateProps } from './ToggleTemplate'
33
import styles from '@patternfly/react-styles/css/components/Pagination/pagination';
44
import { css } from '@patternfly/react-styles';
55
import { fillTemplate } from '../../helpers';
6-
import { Navigation } from './Navigation';
6+
import { PaginationNavigation } from './PaginationNavigation';
77
import { PaginationOptionsMenu } from './PaginationOptionsMenu';
88
import { useOUIAProps, OUIAProps } from '../../helpers';
99
import { formatBreakpointMods } from '../../helpers/util';
@@ -342,7 +342,7 @@ export const Pagination: React.FunctionComponent<PaginationProps> = ({
342342
appendTo={menuAppendTo}
343343
/>
344344
)}
345-
<Navigation
345+
<PaginationNavigation
346346
pagesTitle={titles.page}
347347
pagesTitlePlural={titles.pages}
348348
toLastPageAriaLabel={titles.toLastPageAriaLabel}

packages/react-core/src/components/Pagination/Navigation.tsx renamed to packages/react-core/src/components/Pagination/PaginationNavigation.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { OnSetPage } from './Pagination';
1111
import { pluralize, PickOptional } from '../../helpers';
1212
import { KeyTypes } from '../../helpers/constants';
1313

14-
export interface NavigationProps extends React.HTMLProps<HTMLElement> {
14+
export interface PaginationNavigationProps extends React.HTMLProps<HTMLElement> {
1515
/** Additional classes for the pagination navigation container. */
1616
className?: string;
1717
/** Accessible label for the input displaying the current page. */
@@ -60,18 +60,18 @@ export interface NavigationProps extends React.HTMLProps<HTMLElement> {
6060
onSetPage: OnSetPage;
6161
}
6262

63-
export interface NavigationState {
63+
export interface PaginationNavigationState {
6464
userInputPage?: number | string;
6565
}
6666

67-
class Navigation extends Component<NavigationProps, NavigationState> {
68-
static displayName = 'Navigation';
69-
constructor(props: NavigationProps) {
67+
class PaginationNavigation extends Component<PaginationNavigationProps, PaginationNavigationState> {
68+
static displayName = 'PaginationNavigation';
69+
constructor(props: PaginationNavigationProps) {
7070
super(props);
7171
this.state = { userInputPage: this.props.page };
7272
}
7373

74-
static defaultProps: PickOptional<NavigationProps> = {
74+
static defaultProps: PickOptional<PaginationNavigationProps> = {
7575
className: '',
7676
isDisabled: false,
7777
isCompact: false,
@@ -104,7 +104,7 @@ class Navigation extends Component<NavigationProps, NavigationState> {
104104
}
105105

106106
private onChange(event: React.FormEvent<HTMLInputElement>, lastPage: number): void {
107-
const inputPage = Navigation.parseInteger(event.currentTarget.value, lastPage);
107+
const inputPage = PaginationNavigation.parseInteger(event.currentTarget.value, lastPage);
108108
this.setState({ userInputPage: Number.isNaN(inputPage) ? event.currentTarget.value : inputPage });
109109
}
110110

@@ -126,7 +126,7 @@ class Navigation extends Component<NavigationProps, NavigationState> {
126126
'ArrowDown'
127127
];
128128
if (event.key === KeyTypes.Enter) {
129-
const inputPage = Navigation.parseInteger(this.state.userInputPage, lastPage);
129+
const inputPage = PaginationNavigation.parseInteger(this.state.userInputPage, lastPage);
130130
onPageInput(event, Number.isNaN(inputPage) ? page : inputPage);
131131
this.handleNewPage(event, Number.isNaN(inputPage) ? page : inputPage);
132132
} else if (!/^\d*$/.test(event.key) && !allowedKeys.includes(event.key)) {
@@ -141,7 +141,7 @@ class Navigation extends Component<NavigationProps, NavigationState> {
141141
return onSetPage(_evt, newPage, perPage, startIdx, endIdx);
142142
};
143143

144-
componentDidUpdate(lastState: NavigationProps) {
144+
componentDidUpdate(lastState: PaginationNavigationProps) {
145145
if (
146146
this.props.page !== lastState.page &&
147147
this.props.page <= this.props.lastPage &&
@@ -271,4 +271,4 @@ class Navigation extends Component<NavigationProps, NavigationState> {
271271
}
272272
}
273273

274-
export { Navigation };
274+
export { PaginationNavigation };

packages/react-core/src/components/Pagination/__tests__/Generated/Navigation.test.tsx renamed to packages/react-core/src/components/Pagination/__tests__/Generated/PaginationNavigation.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
* This test was generated
33
*/
44
import { render } from '@testing-library/react';
5-
import { Navigation } from '../../Navigation';
5+
import { PaginationNavigation } from '../../PaginationNavigation';
66
// any missing imports can usually be resolved by adding them here
77
import {} from '../..';
88

99
it('Navigation should match snapshot (auto-generated)', () => {
1010
const { asFragment } = render(
11-
<Navigation
11+
<PaginationNavigation
1212
className={"''"}
1313
isDisabled={false}
1414
isCompact={false}

packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/Navigation.test.tsx.snap renamed to packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/PaginationNavigation.test.tsx.snap

File renamed without changes.

0 commit comments

Comments
 (0)