Skip to content

Instantly share code, notes, and snippets.

@siisee11
Created January 9, 2020 15:08
Show Gist options
  • Save siisee11/86109b588287268a2735f2a7a912dc7c to your computer and use it in GitHub Desktop.
Save siisee11/86109b588287268a2735f2a7a912dc7c to your computer and use it in GitHub Desktop.
import React from "react"
import { graphql } from "gatsby"
import Layout from "../components/layout"
export default ({ data }) => {
console.log(data)
return (
<Layout>
<div>
<h1>My Site's Files</h1>
<table>
<thead>
<tr>
<th>relativePath</th>
<th>prettySize</th>
<th>extension</th>
<th>birthTime</th>
</tr>
</thead>
<tbody>
{data.allFile.edges.map(({ node }, index) => (
<tr key={index}>
<td>{node.relativePath}</td>
<td>{node.prettySize}</td>
<td>{node.extension}</td>
<td>{node.birthTime}</td>
</tr>
))}
</tbody>
</table>
</div>
</Layout>
)
}
export const query = graphql`
query {
allFile {
edges {
node {
relativePath
prettySize
extension
birthTime(fromNow: true)
}
}
}
}
`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment