Add glossary page
This commit is contained in:
@ -5,8 +5,7 @@ import React from 'react';
|
|||||||
// ===================================================
|
// ===================================================
|
||||||
const SimpleCard = ({
|
const SimpleCard = ({
|
||||||
title,
|
title,
|
||||||
children,
|
children
|
||||||
isDarkMode
|
|
||||||
}) => (
|
}) => (
|
||||||
<div className='card short'>
|
<div className='card short'>
|
||||||
<h4 className='card-title'>
|
<h4 className='card-title'>
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import Meta from '../components/Meta';
|
|||||||
import Shell from '../components/Shell';
|
import Shell from '../components/Shell';
|
||||||
import SnippetCard from '../components/SnippetCard';
|
import SnippetCard from '../components/SnippetCard';
|
||||||
|
|
||||||
import { capitalize, getRawCodeBlocks as getCodeBlocks } from '../util';
|
import { getRawCodeBlocks as getCodeBlocks } from '../util';
|
||||||
|
|
||||||
// ===================================================
|
// ===================================================
|
||||||
// Individual snippet category/tag page
|
// Individual snippet category/tag page
|
||||||
|
|||||||
60
src/docs/pages/glossary.js
Normal file
60
src/docs/pages/glossary.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { graphql } from 'gatsby';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { pushNewPage } from '../state/app';
|
||||||
|
|
||||||
|
import Meta from '../components/Meta';
|
||||||
|
import Shell from '../components/Shell';
|
||||||
|
import SimpleCard from '../components/SimpleCard';
|
||||||
|
|
||||||
|
// ===================================================
|
||||||
|
// Individual snippet category/tag page
|
||||||
|
// ===================================================
|
||||||
|
const GlossaryPage = props => {
|
||||||
|
const posts = props.data.snippetDataJson.data;
|
||||||
|
console.log(posts);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
props.dispatch(pushNewPage('Glossary', props.path));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Meta title='Glossary' />
|
||||||
|
<Shell>
|
||||||
|
<h2 className='page-title'>Glossary</h2>
|
||||||
|
<p className='page-sub-title'>Developers use a lot of terminology daily. Every once in a while, you might find a term you do not know. We know how frustrating that can get, so we provide you with a handy glossary of frequently used web development terms.</p>
|
||||||
|
{posts &&
|
||||||
|
posts.map(term => (
|
||||||
|
<SimpleCard title={term.title}>
|
||||||
|
<p>{term.attributes.text}</p>
|
||||||
|
</SimpleCard>
|
||||||
|
))}
|
||||||
|
</Shell>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default connect(
|
||||||
|
state => ({
|
||||||
|
isDarkMode: state.app.isDarkMode,
|
||||||
|
lastPageTitle: state.app.lastPageTitle,
|
||||||
|
lastPageUrl: state.app.lastPageUrl,
|
||||||
|
searchQuery: state.app.searchQuery,
|
||||||
|
}),
|
||||||
|
null,
|
||||||
|
)(GlossaryPage);
|
||||||
|
|
||||||
|
export const archivePageQuery = graphql`
|
||||||
|
query GlossaryPage {
|
||||||
|
snippetDataJson(meta: {type: {eq: "glossaryTermArray"}}) {
|
||||||
|
data {
|
||||||
|
attributes {
|
||||||
|
text
|
||||||
|
}
|
||||||
|
title
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
@ -61,16 +61,21 @@ const ListPage = props => {
|
|||||||
return acc;
|
return acc;
|
||||||
}, []);
|
}, []);
|
||||||
const staticPages = [
|
const staticPages = [
|
||||||
|
{
|
||||||
|
url: 'beginner',
|
||||||
|
title: 'Beginner snippets',
|
||||||
|
description: 'Snippets aimed towards individuals at the start of their web developer journey.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
url: 'glossary',
|
||||||
|
title: 'Glossary',
|
||||||
|
description: 'A handy glossary of web development terminology.',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
url: 'about',
|
url: 'about',
|
||||||
title: 'About',
|
title: 'About',
|
||||||
description: 'A few word about us, our goals and our projects.',
|
description: 'A few word about us, our goals and our projects.',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
url: 'beginner',
|
|
||||||
title: 'Beginner snippets',
|
|
||||||
description: 'Snippets aimed towards individuals at the start of their web developer journey.',
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
|
|||||||
1
src/docs/templates/TagPage.js
vendored
1
src/docs/templates/TagPage.js
vendored
@ -66,7 +66,6 @@ export const tagPageQuery = graphql`
|
|||||||
totalCount
|
totalCount
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
excerpt(pruneLength: 400)
|
|
||||||
id
|
id
|
||||||
html
|
html
|
||||||
rawMarkdownBody
|
rawMarkdownBody
|
||||||
|
|||||||
Reference in New Issue
Block a user