Skip to content

Commit

Permalink
Initial attempt at separating documents in search results
Browse files Browse the repository at this point in the history
  • Loading branch information
john681611 committed Jun 30, 2023
1 parent 23f16ec commit 6b690a9
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ import { getDocumentDisplayName } from 'application/frontend/src/utils/document'

export const SearchResults = ({ results }) => {
if (results && results.length != 0) {
const sortedResults = results.sort((a, b) => getDocumentDisplayName(a).localeCompare(getDocumentDisplayName(b)))
let lastDocumentName = sortedResults[0].id ?? sortedResults[0].name
return (
<>
{results.sort((a, b) => getDocumentDisplayName(a).localeCompare(getDocumentDisplayName(b))).map((document, i) => (
<div key={i} className="accordion ui fluid styled standard-page__links-container">
<DocumentNode node={document} linkType={'Standard'} />
</div>
{sortedResults.map((document, i) => (
<>
{lastDocumentName !== (document.id ?? document.name) &&<hr style={{marginTop: "20px"}} />}
<div key={i} className="accordion ui fluid styled standard-page__links-container">
<DocumentNode node={document} linkType={'Standard'} />
</div>
</>
))}
</>
);
Expand Down

0 comments on commit 6b690a9

Please sign in to comment.