From 4d7dd1bb5efc3fa31fb5798be320fe71a4dbc794 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Sirois Date: Mon, 25 May 2020 09:44:56 -0400 Subject: [PATCH] ui(resources): tweak resource list for single page --- src/components/ResourcesList/index.tsx | 27 +++++++++++-------- .../resources/bot-development/intro.md | 2 +- src/content/resources/cpp/intro.md | 10 +++---- src/content/resources/cryptography/intro.md | 6 ++--- src/content/resources/java/intro.md | 12 ++++----- src/content/resources/javascript/intro.md | 8 +++--- src/content/resources/kotlin/intro.md | 6 ++--- src/content/resources/php/intro.md | 4 +-- src/content/resources/python/intro.md | 10 +++---- 9 files changed, 45 insertions(+), 40 deletions(-) diff --git a/src/components/ResourcesList/index.tsx b/src/components/ResourcesList/index.tsx index d100f89..872c165 100644 --- a/src/components/ResourcesList/index.tsx +++ b/src/components/ResourcesList/index.tsx @@ -26,7 +26,7 @@ const ALL_RESOURCES = graphql` } ` -function plantTree(item: IFileOrFolder, index?: number) { +function plantTree(item: IFileOrFolder, single?: boolean) { if (item.type === "file") { // remove the first elements, treat as hardcoded const [, , , ...cleanedUpPath] = item.path.split("/") @@ -42,17 +42,21 @@ function plantTree(item: IFileOrFolder, index?: number) { ) } - return + return } -const Language = memo(({ item }: { item: IFolder; index: number }) => { - return ( - - {humanize(item.title)} - {item.children.map((node) => plantTree(node))} - - ) -}) +const Language = memo( + ({ item, single }: { item: IFolder; single: boolean }) => { + return ( + + {!single && {humanize(item.title)}} + + {item.children.map((node) => plantTree(node))} + + + ) + } +) interface IResourcesList extends HTMLAttributes { relativeDirectory?: string @@ -78,10 +82,11 @@ export const ResourcesList: FC = (props) => { const tree = useBuildTree(filteredResources) const sortedTree = sort((a, b) => a.title.localeCompare(b.title), tree) + const isSingle = Boolean(props.relativeDirectory) return ( - {sortedTree.map((node, index) => plantTree(node, index))} + {sortedTree.map((node) => plantTree(node, isSingle))} ) } diff --git a/src/content/resources/bot-development/intro.md b/src/content/resources/bot-development/intro.md index cd852b5..6e89d14 100644 --- a/src/content/resources/bot-development/intro.md +++ b/src/content/resources/bot-development/intro.md @@ -5,6 +5,6 @@ created_at: 2020/04/20 title: Bot Development --- -## About +###### About In TPH, we employ the use of various Discord bots to help with a myriad of tasks such as moderation and managing embeds. diff --git a/src/content/resources/cpp/intro.md b/src/content/resources/cpp/intro.md index 074788c..4c08882 100644 --- a/src/content/resources/cpp/intro.md +++ b/src/content/resources/cpp/intro.md @@ -5,28 +5,28 @@ created_at: 2019/12/15 title: C++ --- -## Beginner +###### Beginner - [Get started](https://isocpp.org/get-started) - [Learn C++](http://www.learncpp.com/) - [C++ tutorial](http://www.cplusplus.com/doc/tutorial/) -## Documentation +###### Documentation - [C++ reference](http://en.cppreference.com/w/) - [https://isocpp.org/std/the-standard](https://isocpp.org/std/the-standard) - [http://eel.is/c++draft/](http://eel.is/c++draft/) -## Books +###### Books - [The definitive C books](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list/388282#388282) -## Video +###### Video - [TPH Picks](https://goo.gl/emLpwP) - [Cherno](https://www.youtube.com/playlist?list=PLlrATfBNZ98dudnM48yfGUldqGD0S4FFb) -## Other +###### Other - [Super FAQ](https://isocpp.org/wiki/faq) - [Compilers](http://www.stroustrup.com/compilers.html) diff --git a/src/content/resources/cryptography/intro.md b/src/content/resources/cryptography/intro.md index 413df12..ae7a6a2 100644 --- a/src/content/resources/cryptography/intro.md +++ b/src/content/resources/cryptography/intro.md @@ -5,17 +5,17 @@ created_at: 2020/04/23 title: Introduction to Cryptography --- -## Popular Science Books +###### Popular Science Books - [The Codebreakers](https://www.amazon.com/Codebreakers-Comprehensive-History-Communication-Internet/dp/0684831309) - [Seizing the Enigma: The Race to Break the German U-Boats Codes](https://www.amazon.com/Seizing-Enigma-German-U-Boats-1939-1943/dp/0395427398) -## Books +###### Books - [Handbook of Applied Cryptography - Free](http://cacr.uwaterloo.ca/hac/) - [Serious Cryptography](https://nostarch.com/seriouscrypto) - [Cryptograpy Engineering](https://www.schneier.com/books/cryptography_engineering/) -## Video +###### Video - [Coursera](https://www.coursera.org/learn/crypto) diff --git a/src/content/resources/java/intro.md b/src/content/resources/java/intro.md index 8aa3255..519d2ed 100644 --- a/src/content/resources/java/intro.md +++ b/src/content/resources/java/intro.md @@ -5,30 +5,30 @@ created_at: 2019/12/15 title: Java --- -## Documentation +###### Documentation - [Java docs](https://docs.oracle.com/en/java/javase/11/) -## Free Books +###### Free Books - [https://goo.gl/WZTC9C](https://goo.gl/WZTC9C) -## Video +###### Video - [EJ Media](https://goo.gl/tC1KwC) - [Derek Banas](https://goo.gl/9eVFkE) - [Free With Registration | Cave of Programming](https://goo.gl/NXTo4H) -## Guides +###### Guides - [Learn By Examples | Beginnersbook.com](https://goo.gl/3nDWeQ) -## Useful Repositories +###### Useful Repositories - [Frameworks](https://goo.gl/EoLvrH) - [Design patterns](https://goo.gl/wT7SfQ) -## Other +###### Other - [History of Java](https://en.wikipedia.org/wiki/Java_version_history) - [Wikibooks](https://en.wikibooks.org/wiki/Java_Programming/History) diff --git a/src/content/resources/javascript/intro.md b/src/content/resources/javascript/intro.md index 1a10c45..a86b1d7 100644 --- a/src/content/resources/javascript/intro.md +++ b/src/content/resources/javascript/intro.md @@ -5,7 +5,7 @@ created_at: 2019/12/15 title: Javascript --- -## Documentation +###### Documentation - [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript) - [jQuery](https://contribute.jquery.org/documentation/) @@ -13,7 +13,7 @@ title: Javascript - [Typescript](https://www.typescriptlang.org/docs/home.html) - [Discord.js](https://discord.js.org/#/docs/main/stable/general/welcome) -## Tutorials +###### Tutorials - [Eloquent](https://eloquentjavascript.net/) - [You Don't Know JS](https://github.com/getify/You-Dont-Know-JS) @@ -21,12 +21,12 @@ title: Javascript - [Modern JS](https://javascript.info/) - [Evie's Accelerated JS Tutorial](https://evie.gitbook.io/js/) -## Discord.js +###### Discord.js - [An Idiot's Guide](https://anidiots.guide/) - [Discord.js Guide](https://discordjs.guide/) -## Other +###### Other - [You might not need jQuery](https://youmightnotneedjquery.com/) - [You might not need jQuery 2](https://github.com/you-dont-need-x/you-dont-need-jquery) diff --git a/src/content/resources/kotlin/intro.md b/src/content/resources/kotlin/intro.md index 98a004d..7f78142 100644 --- a/src/content/resources/kotlin/intro.md +++ b/src/content/resources/kotlin/intro.md @@ -5,17 +5,17 @@ created_at: 2019/12/15 title: Kotlin --- -## About +###### About One line language description: Kotlin is a general-purpose programming language that can run on a JVM or be transpiled to Javascript code. It can use functional, procedural, and OO paradigms, and can interleave them. Primarily developed by JetBrains. -## Links +###### Links - [Official Website](https://www.kotlinlang.org/) - [Official Docs](https://kotlinlang.org/docs/reference/) - [Tutorials](https://kotlinlang.org/docs/tutorials/) - [Mooc (not free)](https://www.udemy.com/kotlin-course/) -## Recommended reading +###### Recommended reading - Kotlin in Action by Dmitry Jemerov and Svetlana Isakova diff --git a/src/content/resources/php/intro.md b/src/content/resources/php/intro.md index 5f4ec34..d4b5b07 100644 --- a/src/content/resources/php/intro.md +++ b/src/content/resources/php/intro.md @@ -5,7 +5,7 @@ created_at: 2019/12/15 title: PHP --- -## Useful links and documentation +###### Useful links and documentation - [Official documentation](https://secure.php.net/manual/en/) - [Laracasts PHP tutorials](http://laracasts.com/) @@ -13,7 +13,7 @@ title: PHP - [PHP Standard Recommendations](https://www.php-fig.org/psr/) - [OWASP Cheatsheet](https://cheatsheetseries.owasp.org/) -## Useful Libraries +###### Useful Libraries - [Composer package manager](https://getcomposer.org/) - [phpDocumentor](https://www.phpdoc.org/) diff --git a/src/content/resources/python/intro.md b/src/content/resources/python/intro.md index 27d3636..421be0c 100644 --- a/src/content/resources/python/intro.md +++ b/src/content/resources/python/intro.md @@ -5,29 +5,29 @@ created_at: 2019/12/15 title: Python --- -## Beginner +###### Beginner - [Official tutorial](https://docs.python.org/3/tutorial/) - [Automate the boring stuff](https://automatetheboringstuff.com/) - [Beginner's guide](https://wiki.python.org/moin/BeginnersGuide/NonProgrammers) -## Documentation +###### Documentation - [https://docs.python.org/3/](https://docs.python.org/3/) - [https://www.python.org/dev/](https://www.python.org/dev/) -## Video +###### Video - [Socratica](https://goo.gl/8xKVKE) - [thenewboston](https://goo.gl/9EqF2J) -## Books +###### Books - [Free](https://goo.gl/Lxhp7i) - [Python Crash Course - paid](https://goo.gl/XQ7Nx6) - [Advanced - paid](https://wiki.python.org/moin/AdvancedBooks) -## Other +###### Other - [TalkPython | Podcast](https://goo.gl/xwieUA) - [Exercises](http://www.practicepython.org/)