Fix double id on listings pages

[MAILPOET-3329]
This commit is contained in:
Pavel Dohnal
2021-01-21 13:03:40 +01:00
committed by Veljko V
parent 147f2e6a46
commit c521acf1c9
2 changed files with 9 additions and 2 deletions

View File

@ -612,6 +612,7 @@ class Listing extends React.Component {
/> />
{extraActions} {extraActions}
<ListingPages <ListingPages
position="top"
count={this.state.count} count={this.state.count}
page={this.state.page} page={this.state.page}
limit={this.state.limit} limit={this.state.limit}
@ -664,6 +665,7 @@ class Listing extends React.Component {
</table> </table>
<div className="mailpoet-listing-footer clearfix"> <div className="mailpoet-listing-footer clearfix">
<ListingPages <ListingPages
position="bottom"
count={this.state.count} count={this.state.count}
page={this.state.page} page={this.state.page}
limit={this.state.limit} limit={this.state.limit}

View File

@ -176,7 +176,7 @@ class ListingPages extends React.Component {
<span className="mailpoet-listing-paging-input"> <span className="mailpoet-listing-paging-input">
<label <label
className="screen-reader-text" className="screen-reader-text"
htmlFor="current-page-selector" htmlFor={`current-page-selector-${this.props.position}`}
> >
{MailPoet.I18n.t('currentPage')} {MailPoet.I18n.t('currentPage')}
</label> </label>
@ -189,7 +189,7 @@ class ListingPages extends React.Component {
size="2" size="2"
value={pageValue} value={pageValue}
name="paged" name="paged"
id="current-page-selector" id={`current-page-selector-${this.props.position}`}
className="mailpoet-listing-current-page" className="mailpoet-listing-current-page"
/> />
{MailPoet.I18n.t('pageOutOf')} {MailPoet.I18n.t('pageOutOf')}
@ -229,6 +229,7 @@ class ListingPages extends React.Component {
} }
ListingPages.propTypes = { ListingPages.propTypes = {
position: PropTypes.string,
onSetPage: PropTypes.func.isRequired, onSetPage: PropTypes.func.isRequired,
page: PropTypes.oneOfType([ page: PropTypes.oneOfType([
PropTypes.number, PropTypes.number,
@ -238,6 +239,10 @@ ListingPages.propTypes = {
limit: PropTypes.number.isRequired, limit: PropTypes.number.isRequired,
}; };
ListingPages.defaultProps = {
position: '',
};
/* type ArrowProps = { /* type ArrowProps = {
direction?: 'right', direction?: 'right',
disabled?: boolean disabled?: boolean