Skip to content

Commit 2dc67ce

Browse files
committed
make difficulty optional
1 parent 8f3a98b commit 2dc67ce

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/components/TutorialsGrid.astro

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ const difficulties = {
8686

8787
const difficulty = tutorial.data.difficulty;
8888

89-
if (!difficulty) {
90-
throw new Error(`${tutorial.id} is missing difficulty property`);
91-
}
92-
9389
const YOUTUBE_DOMAINS = ["www.youtube.com", "youtube.com", "youtu.be"];
9490
const youtube =
9591
tutorial.collection === "videos" &&
@@ -98,12 +94,14 @@ const difficulties = {
9894
const spotlight =
9995
tutorial.collection === "docs" && tutorial.data.spotlight;
10096

101-
const badges: BadgeType[] = [
102-
{
97+
const badges: BadgeType[] = [];
98+
99+
if (difficulty) {
100+
badges.push({
103101
text: difficulty,
104102
variant: difficulties[difficulty],
105-
},
106-
];
103+
});
104+
}
107105

108106
if (youtube) {
109107
badges.push({

0 commit comments

Comments
 (0)