Skip to content

Commit

Permalink
fix: removed automatic pager-link and updated available manual data-e…
Browse files Browse the repository at this point in the history
…lements
  • Loading branch information
pnicolli committed Dec 12, 2023
1 parent ee21c7d commit 2553322
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 28 deletions.
14 changes: 14 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@
- ...
-->

## Versione X.X.X (dd/mm/yyyy)

### Migliorie

- ...

### Novità

- ... [`Istruzioni`](url della documentazione relativa alla novità)

### Fix

- Rimosso pager-link automatico dal paginatore perché non riconosciuto dal validatore. È ora possibile inserire a mano il data-element pager-link nei blocchi di testo.

## Versione 10.5.0 (06/12/2023)

### Novità
Expand Down
13 changes: 2 additions & 11 deletions src/components/ItaliaTheme/Pagination/Pagination.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ class Pagination extends Component {
/** Total number of pages. */
totalPages: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
.isRequired,

/** Lighthouse ID to set Agid data-element on pager link for CT Servizio*/
isServiceLink: PropTypes.bool,
};

static defaultProps = {
Expand All @@ -72,13 +69,8 @@ class Pagination extends Component {
};

render() {
const {
boundaryRange,
ellipsisItem,
siblingRange,
totalPages,
isServiceLink,
} = this.props;
const { boundaryRange, ellipsisItem, siblingRange, totalPages } =
this.props;
const { activePage } = this.state;

const items = createPaginationItems({
Expand All @@ -104,7 +96,6 @@ class Pagination extends Component {
onClick={this.handleItemClick}
type={type}
ellipsisItem={ellipsisItem}
isServiceLink={isServiceLink}
>
{value}
</PaginationItem>
Expand Down
9 changes: 1 addition & 8 deletions src/components/ItaliaTheme/Pagination/PaginationItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ class PaginationItem extends Component {
'nextItem',
'lastItem',
]),

/** Lighthouse ID to set Agid data-element on pager link for CT Servizio*/
isServiceLink: PropTypes.bool,
};

handleClick = (e) => {
Expand All @@ -62,8 +59,7 @@ class PaginationItem extends Component {
};

render() {
const { active, type, children, intl, ellipsisItem, isServiceLink } =
this.props;
const { active, type, children, intl, ellipsisItem } = this.props;
const disabled = this.props.disabled || type === 'ellipsisItem';
return (
<PagerItem disabled={disabled}>
Expand All @@ -72,9 +68,6 @@ class PaginationItem extends Component {
onClick={this.handleClick}
onKeyDown={this.handleKeyDown}
aria-current={active ? 'page' : null}
data-element={
isServiceLink && type !== 'prevItem' ? 'pager-link' : null
}
>
{type === 'prevItem' && (
<>
Expand Down
1 change: 0 additions & 1 deletion src/config/Blocks/ListingOptions/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ export const addLighthouseField = (schema, intl, position = 0) => {
['service-category-link', 'service-category-link'],
['topic-element', 'topic-element'],
['service-link', 'service-link'],
['administration-element', 'administration-element'],
['management-category-link', 'management-category-link'],
['news-category-link', 'news-category-link'],
['custom-category-link', 'custom-category-link'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class AddLinkForm extends Component {
['accessibility-link', 'accessibility-link'],
['privacy-policy-link', 'privacy-policy-link'],
['legal-notes', 'legal-notes'],
['pager-link', 'pager-link'],
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,6 @@ const ListingBody = React.memo(
// Also need to purge title from searchblock schema, it's the name of the listing template used
const listingBodyProps =
variation?.['@type'] !== 'search' ? data : { ...variation, title: '' };

// Need to know if data-element is "service-link"
// to add data-element="pager-link" to pagination links
const isServiceLink =
data?.id_lighthouse === 'service-link' ||
variation?.id_lighthouse === 'service-link';

return (
<div className="public-ui">
{loadingQuery && (
Expand Down Expand Up @@ -130,7 +123,6 @@ const ListingBody = React.memo(
activePage={currentPage}
totalPages={totalPages}
onPageChange={onPaginationChange}
isServiceLink={isServiceLink}
/>
</div>
)}
Expand Down

0 comments on commit 2553322

Please sign in to comment.