mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-04 09:15:58 +02:00
ui(resources): tweak resource list for single page
This commit is contained in:
@@ -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 <Language key={item.title} item={item} index={index!} />
|
||||
return <Language key={item.title} item={item} single={Boolean(single)} />
|
||||
}
|
||||
|
||||
const Language = memo(({ item }: { item: IFolder; index: number }) => {
|
||||
return (
|
||||
<SC.TreeWrapper>
|
||||
<SC.LanguageLabel>{humanize(item.title)}</SC.LanguageLabel>
|
||||
<SC.Children>{item.children.map((node) => plantTree(node))}</SC.Children>
|
||||
</SC.TreeWrapper>
|
||||
)
|
||||
})
|
||||
const Language = memo(
|
||||
({ item, single }: { item: IFolder; single: boolean }) => {
|
||||
return (
|
||||
<SC.TreeWrapper>
|
||||
{!single && <SC.LanguageLabel>{humanize(item.title)}</SC.LanguageLabel>}
|
||||
<SC.Children>
|
||||
{item.children.map((node) => plantTree(node))}
|
||||
</SC.Children>
|
||||
</SC.TreeWrapper>
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
interface IResourcesList extends HTMLAttributes<HTMLDivElement> {
|
||||
relativeDirectory?: string
|
||||
@@ -78,10 +82,11 @@ export const ResourcesList: FC<IResourcesList> = (props) => {
|
||||
|
||||
const tree = useBuildTree(filteredResources)
|
||||
const sortedTree = sort((a, b) => a.title.localeCompare(b.title), tree)
|
||||
const isSingle = Boolean(props.relativeDirectory)
|
||||
|
||||
return (
|
||||
<SC.ResourcesListWrapper {...props}>
|
||||
{sortedTree.map((node, index) => plantTree(node, index))}
|
||||
{sortedTree.map((node) => plantTree(node, isSingle))}
|
||||
</SC.ResourcesListWrapper>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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/)
|
||||
|
||||
@@ -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/)
|
||||
|
||||
Reference in New Issue
Block a user