Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion _components/LandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import {
} from "../examples/_components/LearningList.tsx";
import { TutorialIcon } from "../examples/_components/TutorialIcon.tsx";
import { VideoIcon } from "../examples/_components/VideoIcon.tsx";
import { featuredItems, sidebar } from "../examples/_data.ts";
import {
cookbookCategories,
featuredItems,
sidebar,
} from "../examples/_data.ts";

function FeaturedStar() {
return (
Expand Down Expand Up @@ -38,6 +42,7 @@ export default function LandingPage(
title={item.title}
items={item.items}
descriptions={descriptions}
isReference={cookbookCategories.includes(item.title)}
/>
);
},
Expand Down
9 changes: 8 additions & 1 deletion examples/_components/LearningList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,20 @@ export function LearningList(
title: string;
items: SidebarItem[];
descriptions?: Record<string, string>;
isReference?: boolean;
},
) {
const anchor = props.title.toLowerCase().replace(/\s+/g, "-");
return (
<section className="mb-10">
<h2 id={anchor} className="text-lg md:text-xl font-semibold mb-4 mt-0">
{props.title}&nbsp;
{props.title}
{props.isReference && (
<span className="ml-2 align-middle text-xs font-medium uppercase tracking-wide text-foreground-secondary border border-foreground-tertiary rounded px-1.5 py-0.5">
Reference
</span>
)}
&nbsp;
<a class="header-anchor" href={`#${anchor}`}>
<span class="sr-only">Jump to heading</span>
<span aria-hidden="true" class="anchor-end">#</span>
Expand Down
10 changes: 10 additions & 0 deletions examples/_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2067,5 +2067,15 @@ export const featuredItems = [
},
];

// Categories that are copy-paste reference snippets rather than
// walkthrough-style guides. The landing page tags these as "Reference" so
// newcomers can tell them apart from tutorial-grade content.
export const cookbookCategories = [
"File system",
"System",
"Web standard APIs",
"Encoding",
];

export const sectionTitle = "Examples";
export const sectionHref = "/examples/";
Loading