Skip to content

Commit

Permalink
fix: new condition create for type Link
Browse files Browse the repository at this point in the history
  • Loading branch information
Wagner3UB committed Aug 17, 2023
1 parent 1a3d23e commit 1793fb1
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,26 @@ const CartellaModulisticaView = ({ content }) => {
);
};

const filterItemsFN = (item) => {
return (
item?.title.toLowerCase().indexOf((searchableText ?? '').toLowerCase()) >=
0
);
};

const filterModulistica = (section) => {
if (section['@type'] === 'Document') {
if (searchableText?.length > 0) {
return (section?.items ?? []).filter(filterDocumento).length > 0;
}
return true;
} else if (section['@type'] === 'Link') {
return true;
} else {
return (section?.items ?? []).filter(filterItemsFN)?.length > 0;
}
};

const filterItemsFN = (item) =>
item?.title.toLowerCase().indexOf((searchableText ?? '').toLowerCase()) >=
0;

return (
<>
<div className="container px-4 my-4 cartellamodulistica-view">
Expand Down Expand Up @@ -132,11 +137,7 @@ const CartellaModulisticaView = ({ content }) => {
</div>
) : (
<div className="document-row-section" key={section['@id']}>
<DocRow
doc={section}
key={section['@id']}
items={section.items.filter(filterItemsFN)}
/>
<DocRow doc={section} />
</div>
);
})}
Expand Down

0 comments on commit 1793fb1

Please sign in to comment.