Skip to content

Commit

Permalink
Add: Sort all document lists by title (#309)
Browse files Browse the repository at this point in the history
Co-authored-by: Spyros <[email protected]>
  • Loading branch information
john681611 and northdpole committed Jun 27, 2023
1 parent 217072c commit 47b5cc2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const CommonRequirementEnumeration = () => {
{getDocumentDisplayName(display)}
<b>{DOCUMENT_TYPE_NAMES[type]}</b>:
</div>
{links.map((link, i) => (
{links.sort((a, b) => getDocumentDisplayName(a.document).localeCompare(getDocumentDisplayName(b.document))).map((link, i) => (
<div key={i} className="accordion ui fluid styled cre-page__links-container">
<DocumentNode node={link.document} linkType={type} />
<FilterButton document={link.document} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react';

import { DocumentNode } from '../../../components/DocumentNode';
import { getDocumentDisplayName } from 'application/frontend/src/utils/document';

export const SearchResults = ({ results }) => {
if (results && results.length != 0) {
return (
<>
{results.map((document, i) => (
{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>
Expand Down
3 changes: 2 additions & 1 deletion application/frontend/src/pages/Standard/Standard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { DocumentNode } from '../../components/DocumentNode';
import { LoadingAndErrorIndicator } from '../../components/LoadingAndErrorIndicator';
import { useEnvironment } from '../../hooks';
import { Document } from '../../types';
import { getDocumentDisplayName } from '../../utils/document';

export const Standard = () => {
let { type, id } = useParams();
Expand Down Expand Up @@ -44,7 +45,7 @@ export const Standard = () => {
<LoadingAndErrorIndicator loading={loading} error={error} />
{!loading &&
!error &&
documents.map((standard, i) => (
documents.sort((a, b) => getDocumentDisplayName(a).localeCompare(getDocumentDisplayName(b))).map((standard, i) => (
<div key={i} className="accordion ui fluid styled standard-page__links-container">
<DocumentNode node={standard} linkType={'Standard'} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const StandardSection = () => {
{getDocumentDisplayName(document)}
<b>{DOCUMENT_TYPE_NAMES[type]}</b>:
</div>
{links.map((link, i) => (
{links.sort((a, b) => getDocumentDisplayName(a.document).localeCompare(getDocumentDisplayName(b.document))).map((link, i) => (
<div key={i} className="accordion ui fluid styled cre-page__links-container">
<DocumentNode node={link.document} linkType={type} />
</div>
Expand Down

0 comments on commit 47b5cc2

Please sign in to comment.