mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-27 19:20:12 +02:00
Fix types of resources
This commit is contained in:
@@ -44,7 +44,7 @@ Visit the following resources to learn more:
|
|||||||
- [@type@Description of link](Link)
|
- [@type@Description of link](Link)
|
||||||
```
|
```
|
||||||
|
|
||||||
`@type@` can be one of the following:
|
`@type@` must be one of the following and describes the type of content you are adding:
|
||||||
|
|
||||||
- `@official@`
|
- `@official@`
|
||||||
- `@opensource@`
|
- `@opensource@`
|
||||||
@@ -54,6 +54,8 @@ Visit the following resources to learn more:
|
|||||||
- `@podcast@`
|
- `@podcast@`
|
||||||
- `@video@`
|
- `@video@`
|
||||||
|
|
||||||
|
It's important to add a valid type, this will help us categorize the content and display it properly on the roadmap.
|
||||||
|
|
||||||
## Guidelines
|
## Guidelines
|
||||||
|
|
||||||
- <p><strong>Adding everything available out there is not the goal!</strong><br />
|
- <p><strong>Adding everything available out there is not the goal!</strong><br />
|
||||||
|
@@ -52,11 +52,11 @@ const linkTypes: Record<AllowedLinkTypes, string> = {
|
|||||||
course: 'bg-green-400',
|
course: 'bg-green-400',
|
||||||
opensource: 'bg-black text-white',
|
opensource: 'bg-black text-white',
|
||||||
'roadmap.sh': 'bg-black text-white',
|
'roadmap.sh': 'bg-black text-white',
|
||||||
'roadmap': 'bg-black text-white',
|
roadmap: 'bg-black text-white',
|
||||||
podcast: 'bg-purple-300',
|
podcast: 'bg-purple-300',
|
||||||
video: 'bg-purple-300',
|
video: 'bg-purple-300',
|
||||||
website: 'bg-blue-300',
|
website: 'bg-blue-300',
|
||||||
'official': 'bg-blue-600 text-white',
|
official: 'bg-blue-600 text-white',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function TopicDetail(props: TopicDetailProps) {
|
export function TopicDetail(props: TopicDetailProps) {
|
||||||
@@ -190,22 +190,30 @@ export function TopicDetail(props: TopicDetailProps) {
|
|||||||
|
|
||||||
const otherElems = topicDom.querySelectorAll('body > *:not(h1, div)');
|
const otherElems = topicDom.querySelectorAll('body > *:not(h1, div)');
|
||||||
|
|
||||||
const listLinks = Array.from(
|
const listLinks = Array.from(topicDom.querySelectorAll('ul > li > a'))
|
||||||
topicDom.querySelectorAll('ul > li > a'),
|
.map((link, counter) => {
|
||||||
).map((link, counter) => {
|
const typePattern = /@([a-z]+)@/;
|
||||||
const typePattern = /@([a-z]+)@/;
|
let linkText = link.textContent || '';
|
||||||
let linkText = link.textContent || '';
|
const linkHref = link.getAttribute('href') || '';
|
||||||
const linkHref = link.getAttribute('href') || '';
|
const linkType = linkText.match(typePattern)?.[1] || 'article';
|
||||||
const linkType = linkText.match(typePattern)?.[1] || 'article';
|
linkText = linkText.replace(typePattern, '');
|
||||||
linkText = linkText.replace(typePattern, '');
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: `link-${linkHref}-${counter}`,
|
id: `link-${linkHref}-${counter}`,
|
||||||
title: linkText,
|
title: linkText,
|
||||||
url: linkHref,
|
url: linkHref,
|
||||||
type: linkType as AllowedLinkTypes,
|
type: linkType as AllowedLinkTypes,
|
||||||
};
|
};
|
||||||
});
|
})
|
||||||
|
.sort((a, b) => {
|
||||||
|
// official at the top
|
||||||
|
// opensource at second
|
||||||
|
// article at third
|
||||||
|
// videos at fourth
|
||||||
|
// rest at last
|
||||||
|
const order = ['official', 'opensource', 'article', 'video'];
|
||||||
|
return order.indexOf(a.type) - order.indexOf(b.type);
|
||||||
|
});
|
||||||
|
|
||||||
const lastUl = topicDom.querySelector('ul:last-child');
|
const lastUl = topicDom.querySelector('ul:last-child');
|
||||||
if (lastUl) {
|
if (lastUl) {
|
||||||
|
@@ -6,4 +6,4 @@ Visit the following resources to learn more:
|
|||||||
|
|
||||||
- [@roadmap@Visit Dedicated Angular Roadmap](/angular)
|
- [@roadmap@Visit Dedicated Angular Roadmap](/angular)
|
||||||
- [@official@Official - Getting started with Angular](https://angular.io/start)
|
- [@official@Official - Getting started with Angular](https://angular.io/start)
|
||||||
- [@video@Angular for Beginners Course [Full Front End Tutorial with TypeScript]](https://www.youtube.com/watch?v=3qBXWUpoPHo)
|
- [@video@Angular for Beginners Course](https://www.youtube.com/watch?v=3qBXWUpoPHo)
|
||||||
|
@@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
Shadcn UI are beautifully designed components that you can copy and paste into your apps. Accessible. Customizable. Open Source. They are built with Tailwind CSS and Radix UI.
|
Shadcn UI are beautifully designed components that you can copy and paste into your apps. Accessible. Customizable. Open Source. They are built with Tailwind CSS and Radix UI.
|
||||||
|
|
||||||
- [@article@Official Website](https://ui.shadcn.com/)
|
- [@official@Official Shadcn UI Website](https://ui.shadcn.com/)
|
||||||
- [@opensource@Official GitHub Repository](https://github.com/shadcn-ui/ui)
|
- [@opensource@Official GitHub Repository](https://github.com/shadcn-ui/ui)
|
Reference in New Issue
Block a user