59 lines
1.3 KiB
TypeScript
59 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
import Navbar from '../components/navbar';
|
|
import PaginationNav from '../components/pagination';
|
|
import Item from '../components/item';
|
|
import { graphql } from 'gatsby';
|
|
|
|
export default ({ data, pageContext }): JSX.Element => {
|
|
const posts = data.allMdx.edges;
|
|
const { currentPage, numPages, rootPath } = pageContext;
|
|
|
|
return (
|
|
<>
|
|
<Navbar />
|
|
{posts.map(({ node }) => {
|
|
const frontmatter = node.frontmatter;
|
|
return (
|
|
<Item
|
|
title={frontmatter.title}
|
|
subtitle={frontmatter.lang}
|
|
to={rootPath + '/' + frontmatter.path}
|
|
></Item>
|
|
);
|
|
})}
|
|
<PaginationNav
|
|
currentPage={currentPage}
|
|
numPages={numPages}
|
|
rootPath={rootPath}
|
|
/>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export const query = graphql`
|
|
query ProjectsIndexQuery($skip: Int!, $limit: Int!) {
|
|
allMdx(
|
|
sort: { order: DESC, fields: [frontmatter___date] }
|
|
filter: {
|
|
fileAbsolutePath: { glob: "**/src/projects/*" }
|
|
frontmatter: { hidden: { ne: true } }
|
|
}
|
|
limit: $limit
|
|
skip: $skip
|
|
) {
|
|
edges {
|
|
node {
|
|
excerpt(pruneLength: 250)
|
|
frontmatter {
|
|
title
|
|
date(formatString: "YYYY-MM-DD")
|
|
path
|
|
lang
|
|
}
|
|
id
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|