Skip to content

Commit 7078bd7

Browse files
pierreneterskipjack
authored andcommitted
fix(mobile): correctly sort pages in mobile sidebar (#1759)
1 parent 41a5096 commit 7078bd7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/components/Site/Site.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,17 @@ const Site = ({
4444
title: section.path.title,
4545
url: section.url,
4646
pages: section.pages.map(page => ({
47+
file: page.file,
4748
title: page.file.title,
4849
url: page.url
49-
}))
50+
})).sort(({ file: { attributes: a }}, { file: { attributes: b }}) => {
51+
let group1 = a.group.toLowerCase();
52+
let group2 = b.group.toLowerCase();
53+
54+
if (group1 < group2) return -1;
55+
if (group1 > group2) return 1;
56+
return a.sort - b.sort;
57+
})
5058
}))
5159
} />
5260

0 commit comments

Comments
 (0)