Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Repo sync #39066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 27, 2025
Merged
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
2 changes: 1 addition & 1 deletion src/frame/middleware/context/generic-toc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ async function getTocItems(node: Tree, context: Context, opts: Options): Promise
node.childPages.filter(filterHidden).map(async (child) => {
const { page } = child
const title = await page.renderProp('rawTitle', context, { textOnly: true })
const octicon = page.octicon ? page.octicon : null
const octicon = page.octicon ?? null
const category = page.category ? page.category : null
const complexity = page.complexity ? page.complexity : null
const industry = page.industry ? page.industry : null
Expand Down
6 changes: 3 additions & 3 deletions src/landings/components/CategoryLanding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const CategoryLanding = () => {
<div className="pt-8">
<div className="py-5 border-bottom">
<div className="pb-3 mr-5 ml-1 float-xl-left">
<h2>
<h2 aria-live="polite">
{t('explore_articles').replace('{{ number }}', searchResults.length.toString())}
</h2>
</div>
Expand All @@ -135,13 +135,13 @@ export const CategoryLanding = () => {
/>
</div>
</div>
<ul className="clearfix d-flex flex-wrap gutter-md-spacious">
<ul className="clearfix d-flex flex-wrap gutter-md-spacious" aria-live="polite">
{searchResults.map((item, index) => (
<li key={index} className="col-md-6 col-lg-4 col-sm-12 list-style-none p-4">
<CookBookArticleCard
title={item.title}
description={item.intro!}
icon={item.octicon}
icon={item.octicon ?? undefined}
tags={[
...(item.industry || []),
...(item.category || []),
Expand Down
30 changes: 15 additions & 15 deletions src/landings/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
export type BaseTocItem = {
fullPath: string
title: string
intro?: string
intro?: string | null
}

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

// Extended type for child TOC items with additional metadata
export type ChildTocItem = BaseTocItem & {
octicon?: ValidOcticon
category?: string[]
complexity?: string[]
industry?: string[]
octicon?: ValidOcticon | null
category?: string[] | null
complexity?: string[] | null
industry?: string[] | null
}

// Main TOC item type that can contain children
export type TocItem = BaseTocItem & {
childTocItems?: ChildTocItem[]
octicon?: ValidOcticon
category?: string[]
complexity?: string[]
industry?: string[]
octicon?: ValidOcticon | null
category?: string[] | null
complexity?: string[] | null
industry?: string[] | null
}

// Type alias for article card components
Expand Down Expand Up @@ -90,11 +90,11 @@ export function mapRawTocItemToTocItem(raw: RawTocItem): TocItem {
return {
fullPath: raw.fullPath,
title: raw.title,
intro: raw.intro || undefined,
octicon: isValidOcticon(raw.octicon) ? raw.octicon : undefined,
category: raw.category || undefined,
complexity: raw.complexity || undefined,
industry: raw.industry || undefined,
intro: raw.intro || null,
octicon: isValidOcticon(raw.octicon) ? raw.octicon : null,
category: raw.category || null,
complexity: raw.complexity || null,
industry: raw.industry || null,
childTocItems: raw.childTocItems?.map(mapRawTocItemToTocItem),
}
}
Expand All @@ -104,7 +104,7 @@ export function mapRawTocItemToSimpleTocItem(raw: RawTocItem): SimpleTocItem {
return {
fullPath: raw.fullPath,
title: raw.title,
intro: raw.intro || undefined,
...(raw.intro && { intro: raw.intro }),
childTocItems: raw.childTocItems?.map((child) => ({
fullPath: child.fullPath,
title: child.title,
Expand Down
Loading