add description field
This commit is contained in:
parent
1f97f0adf0
commit
4083bbf72e
3 changed files with 28 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
||||||
id: data-types
|
id: data-types
|
||||||
title: Data Types
|
title: Data Types
|
||||||
author: Darren Yao
|
author: Darren Yao
|
||||||
|
description: Learn about the basic data types needed for competitive programming.
|
||||||
---
|
---
|
||||||
|
|
||||||
<module-excerpt>
|
<module-excerpt>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
id: getting-started
|
id: getting-started
|
||||||
title: Getting Started
|
title: Getting Started
|
||||||
author: Nathan Wang, Benjamin Qi, Darren Yao
|
author: Nathan Wang, Benjamin Qi, Darren Yao
|
||||||
|
description: Welcome to the guide! Here we'll explain what a programming competition is, how it works, and how to choose a language.
|
||||||
---
|
---
|
||||||
|
|
||||||
<module-excerpt>
|
<module-excerpt>
|
||||||
|
|
|
@ -5,6 +5,29 @@ import SEO from "../components/seo"
|
||||||
import { graphql, Link } from "gatsby";
|
import { graphql, Link } from "gatsby";
|
||||||
import { divisionLabels, divisions } from "../../content/ordering";
|
import { divisionLabels, divisions } from "../../content/ordering";
|
||||||
import { getModule } from "../utils";
|
import { getModule } from "../utils";
|
||||||
|
import SyllabusModule from "../components/SyllabusModule";
|
||||||
|
|
||||||
|
const renderModule = (node, idx, parentIdx = -1) => {
|
||||||
|
if (node.hasOwnProperty("items")) {
|
||||||
|
return node.items.map((x, i) => renderModule(x, i, idx));
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = node.frontmatter;
|
||||||
|
if (!data.title) return;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SyllabusModule
|
||||||
|
title={`${parentIdx !== -1 ? (parentIdx+1)+"." : ""}${idx+1}. ${data.title}`}
|
||||||
|
url={node.slug}
|
||||||
|
key={node.slug}
|
||||||
|
problems={data.problems}
|
||||||
|
prerequisites={data.prerequisites}
|
||||||
|
author={data.author}
|
||||||
|
>
|
||||||
|
{data.description}
|
||||||
|
</SyllabusModule>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export default function Template(props) {
|
export default function Template(props) {
|
||||||
const data = props.data;
|
const data = props.data;
|
||||||
|
@ -160,6 +183,8 @@ export default function Template(props) {
|
||||||
})}
|
})}
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{module.map((x, idx) => renderModule(x, idx))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -178,6 +203,7 @@ export const pageQuery = graphql`
|
||||||
author
|
author
|
||||||
problems
|
problems
|
||||||
prerequisites
|
prerequisites
|
||||||
|
description
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue