Skip to content

Commit 0b0a6f4

Browse files
committed
Respect ReactElements for backcompat, allow configuring counter name
1 parent 6a3c520 commit 0b0a6f4

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/components/cards.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ import { learnPages } from "./learn-aggregator/learn-pages"
44

55
export function Cards({
66
items,
7-
numbered = false,
7+
numbered,
88
}: {
99
items: {
10-
icon?: (({ className }: { className?: string }) => React.ReactNode) | React.ReactNode
10+
icon?:
11+
| (({ className }: { className?: string }) => React.ReactNode)
12+
| React.ReactNode
1113
title: string
1214
description?: string
1315
link: string
1416
}[]
15-
numbered?: boolean
17+
numbered?: string
1618
}) {
1719
return (
1820
<ul className="grid grid-cols-1 justify-stretch gap-2 pt-6 sm:grid-cols-2 lg:gap-4">
@@ -41,7 +43,7 @@ export function Cards({
4143
<span className="flex flex-col gap-1 [grid-area:header]">
4244
{numbered && (
4345
<span className="typography-body-sm px-2 pt-2 text-neu-700 max-lg:typography-body-md lg:px-4 lg:pt-4">
44-
Lesson {index + 1}
46+
{numbered} {index + 1}
4547
</span>
4648
)}
4749
<span
@@ -52,7 +54,11 @@ export function Cards({
5254
>
5355
{item.icon && (
5456
<span className="flex items-center justify-center border-r border-neu-200 p-2 lg:p-4">
55-
{typeof item.icon === "function" ? <item.icon className="size-8 shrink-0" /> : item.icon}
57+
{typeof item.icon === "function" ? (
58+
<item.icon className="size-8 shrink-0" />
59+
) : (
60+
item.icon
61+
)}
5662
</span>
5763
)}
5864
{item.title}

src/pages/learn/best-practices.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The GraphQL specification is intentionally silent on a handful of important issu
77
The articles in this section should not be taken as gospel, and in some cases may rightfully be ignored in favor of some other approach. Some articles introduce some of the philosophy developed within Facebook around designing and deploying GraphQL services, while others are more tactical suggestions for solving common problems like serving over HTTP and performing authorization.
88

99
<Cards
10+
numbered="Lesson"
1011
items={[
1112
{
1213
title: "Thinking in Graphs",

0 commit comments

Comments
 (0)