Skip to content

Commit b7eee61

Browse files
committed
Sort gallery items alphabetically by title
1 parent 42d311b commit b7eee61

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

config/strudel-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
}
169169
]
170170
},
171-
{
171+
{
172172
"name": "Gallery",
173173
"path": "/gallery"
174174
},

src/pages/gallery.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import advancedFormat from 'dayjs/plugin/advancedFormat'
1818
import { getImageFromFileNode } from '../utils/utils';
1919
import { GatsbyImage } from 'gatsby-plugin-image';
2020
import 'react-photo-view/dist/react-photo-view.css';
21-
import { PhotoProvider, PhotoView } from 'react-photo-view';
2221

2322
dayjs.extend(utc);
2423
dayjs.extend(timezone);
@@ -41,14 +40,17 @@ interface DataProps {
4140
* metadata and details about the event.
4241
*/
4342
const GalleryPage: React.FC<PageProps<DataProps>> = ({ data }) => {
44-
console.log(data);
4543
const allItems = data.allMdx.nodes.map(d => {
4644
if (d.frontmatter.primaryImage) {
4745
d.frontmatter.primaryImageData = getImageFromFileNode(d.frontmatter.primaryImage);
4846
}
4947
return d;
5048
});
5149

50+
allItems.sort((a, b) => {
51+
return a.frontmatter.title.localeCompare(b.frontmatter.title);
52+
});
53+
5254
return (
5355
<BaseLayout>
5456
<PageHeader>

0 commit comments

Comments
 (0)