Skip to content

Commit 85862a8

Browse files
authored
Merge pull request #39066 from github/repo-sync
Repo sync
2 parents 4a38d0c + f76184a commit 85862a8

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

src/frame/middleware/context/generic-toc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ async function getTocItems(node: Tree, context: Context, opts: Options): Promise
122122
node.childPages.filter(filterHidden).map(async (child) => {
123123
const { page } = child
124124
const title = await page.renderProp('rawTitle', context, { textOnly: true })
125-
const octicon = page.octicon ? page.octicon : null
125+
const octicon = page.octicon ?? null
126126
const category = page.category ? page.category : null
127127
const complexity = page.complexity ? page.complexity : null
128128
const industry = page.industry ? page.industry : null

src/landings/components/CategoryLanding.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export const CategoryLanding = () => {
122122
<div className="pt-8">
123123
<div className="py-5 border-bottom">
124124
<div className="pb-3 mr-5 ml-1 float-xl-left">
125-
<h2>
125+
<h2 aria-live="polite">
126126
{t('explore_articles').replace('{{ number }}', searchResults.length.toString())}
127127
</h2>
128128
</div>
@@ -135,13 +135,13 @@ export const CategoryLanding = () => {
135135
/>
136136
</div>
137137
</div>
138-
<ul className="clearfix d-flex flex-wrap gutter-md-spacious">
138+
<ul className="clearfix d-flex flex-wrap gutter-md-spacious" aria-live="polite">
139139
{searchResults.map((item, index) => (
140140
<li key={index} className="col-md-6 col-lg-4 col-sm-12 list-style-none p-4">
141141
<CookBookArticleCard
142142
title={item.title}
143143
description={item.intro!}
144-
icon={item.octicon}
144+
icon={item.octicon ?? undefined}
145145
tags={[
146146
...(item.industry || []),
147147
...(item.category || []),

src/landings/types.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
export type BaseTocItem = {
33
fullPath: string
44
title: string
5-
intro?: string
5+
intro?: string | null
66
}
77

88
// Valid octicon types that match the CookBookArticleCard component
@@ -23,19 +23,19 @@ export type ValidOcticon =
2323

2424
// Extended type for child TOC items with additional metadata
2525
export type ChildTocItem = BaseTocItem & {
26-
octicon?: ValidOcticon
27-
category?: string[]
28-
complexity?: string[]
29-
industry?: string[]
26+
octicon?: ValidOcticon | null
27+
category?: string[] | null
28+
complexity?: string[] | null
29+
industry?: string[] | null
3030
}
3131

3232
// Main TOC item type that can contain children
3333
export type TocItem = BaseTocItem & {
3434
childTocItems?: ChildTocItem[]
35-
octicon?: ValidOcticon
36-
category?: string[]
37-
complexity?: string[]
38-
industry?: string[]
35+
octicon?: ValidOcticon | null
36+
category?: string[] | null
37+
complexity?: string[] | null
38+
industry?: string[] | null
3939
}
4040

4141
// Type alias for article card components
@@ -90,11 +90,11 @@ export function mapRawTocItemToTocItem(raw: RawTocItem): TocItem {
9090
return {
9191
fullPath: raw.fullPath,
9292
title: raw.title,
93-
intro: raw.intro || undefined,
94-
octicon: isValidOcticon(raw.octicon) ? raw.octicon : undefined,
95-
category: raw.category || undefined,
96-
complexity: raw.complexity || undefined,
97-
industry: raw.industry || undefined,
93+
intro: raw.intro || null,
94+
octicon: isValidOcticon(raw.octicon) ? raw.octicon : null,
95+
category: raw.category || null,
96+
complexity: raw.complexity || null,
97+
industry: raw.industry || null,
9898
childTocItems: raw.childTocItems?.map(mapRawTocItemToTocItem),
9999
}
100100
}
@@ -104,7 +104,7 @@ export function mapRawTocItemToSimpleTocItem(raw: RawTocItem): SimpleTocItem {
104104
return {
105105
fullPath: raw.fullPath,
106106
title: raw.title,
107-
intro: raw.intro || undefined,
107+
...(raw.intro && { intro: raw.intro }),
108108
childTocItems: raw.childTocItems?.map((child) => ({
109109
fullPath: child.fullPath,
110110
title: child.title,

0 commit comments

Comments
 (0)