From 3e731ce46855a8a37980dd8e3967e6b76821db40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Peyronnet?= Date: Fri, 9 Dec 2022 19:33:30 +0000 Subject: [PATCH] Sort file with time --- .gitignore | 1 + src/containers/views/StaticIndex.js | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 17106c372..561d888d7 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ node_modules /lib/jekyll-admin/public *.gem .DS_Store +/vendor/ \ No newline at end of file diff --git a/src/containers/views/StaticIndex.js b/src/containers/views/StaticIndex.js index 392f25826..4cb5a593d 100644 --- a/src/containers/views/StaticIndex.js +++ b/src/containers/views/StaticIndex.js @@ -36,16 +36,20 @@ export class StaticIndex extends Component { if (files.length) { return (
- {files.map((file, i) => { - return ( - - ); - })} + {files + .sort((a, b) => + (b?.modified_time ?? '').localeCompare(a.modified_time) + ) + .map((file, i) => { + return ( + + ); + })}
); } else {