Snippet List
Click on a snippet’s name to view its code or a tag name to view all
snippets in that category.
{tags.sort((a,b) => a.localeCompare(b)).map(tag => (
<>
{capitalize(tag)}
{snippets
.filter(snippet => !snippet.archived)
.filter(snippet => snippet.tags[0] === tag)
.map(snippet => (
))}
>
))}
Archived snippets
{archivedSnippets
.filter(snippet => snippet.archived)
.map(snippet => (
))}
{staticPages.map(page => (
{page.title}
)}
>
{page.description}
))}
>
);
};
export default connect(
state => ({
isDarkMode: state.app.isDarkMode,
lastPageTitle: state.app.lastPageTitle,
lastPageUrl: state.app.lastPageUrl,
searchQuery: state.app.searchQuery,
}),
null,
)(ListPage);
export const listPageQuery = graphql`
query snippetListing {
snippetDataJson(meta: { type: { eq: "snippetListingArray" }, scope: {eq: "./snippets"} }) {
data {
id
title
attributes {
tags
text
}
}
}
snippetsArchiveDataJson : snippetDataJson(meta: { type: { eq: "snippetListingArray" }, scope: {eq: "./snippets_archive"} }) {
data {
id
title
attributes {
tags
text
}
}
}
allMarkdownRemark(
limit: 1000
sort: { fields: [frontmatter___title], order: ASC }
) {
totalCount
edges {
node {
id
html
rawMarkdownBody
fields {
slug
}
frontmatter {
title
tags
}
fileAbsolutePath
}
}
}
}
`;