@primer/doctocat-nextjs 0.0.0-20250626095112 → 0.0.0-20250626102357

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # @primer/doctocat-nextjs
2
2
 
3
- ## 0.0.0-20250626095112
3
+ ## 0.0.0-20250626102357
4
4
 
5
5
  ### Patch Changes
6
6
 
7
7
  - Fake entry to force publishing
8
8
 
9
- ## 0.0.0-20250626095110
9
+ ## 0.0.0-20250626102355
10
10
 
11
11
  ### Patch Changes
12
12
 
@@ -149,41 +149,43 @@ export function Theme({pageMap, children}: ThemeProps) {
149
149
  {activeHeaderLink ? activeHeaderLink.title : siteTitle}
150
150
  </Breadcrumbs.Item>
151
151
  )}
152
- {activePath.reduce((acc, item, index, items) => {
153
- const nextItem = items[index + 1]
152
+ {activePath
153
+ .filter((item, index, array) => {
154
+ const nextItem = array[index + 1]
154
155
 
155
- // Skip duplicate item for index pages without tab-label
156
- if (
157
- index < items.length - 1 &&
158
- nextItem.name === 'index' &&
159
- item.route === nextItem.route &&
156
+ // Skip when current item is a folder followed by its index page
157
+ // or when it is an index page with a tabbed navigation
158
+ return !(
159
+ (index < array.length - 1 &&
160
+ nextItem.name === 'index' &&
161
+ item.route === nextItem.route &&
162
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
163
+ !nextItem.frontMatter?.['tab-label']) ||
164
+ (item.name === 'index' &&
165
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
166
+ item.frontMatter?.['tab-label'])
167
+ )
168
+ })
169
+ .map((item, index, visibleItems) => {
160
170
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
161
- !nextItem.frontMatter?.['tab-label']
162
- ) {
163
- return acc
164
- }
171
+ const itemTitle = item.frontMatter?.['tab-label'] || item.title
172
+ const isLastItem = index === visibleItems.length - 1
165
173
 
166
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
167
- const itemTitle = item.frontMatter?.['tab-label'] || item.title
168
- const isLastItem = index === items.length - 1
169
-
170
- acc.push(
171
- <Breadcrumbs.Item
172
- as={NextLink}
173
- key={item.name}
174
- href={item.route}
175
- selected={isLastItem}
176
- sx={{
177
- textTransform: 'capitalize',
178
- color: 'var(--brand-InlineLink-color-rest)',
179
- }}
180
- >
181
- {itemTitle.replace(/-/g, ' ')}
182
- </Breadcrumbs.Item>,
183
- )
184
-
185
- return acc
186
- }, [] as React.ReactNode[])}
174
+ return (
175
+ <Breadcrumbs.Item
176
+ as={NextLink}
177
+ key={item.name}
178
+ href={item.route}
179
+ selected={isLastItem}
180
+ sx={{
181
+ textTransform: 'capitalize',
182
+ color: 'var(--brand-InlineLink-color-rest)',
183
+ }}
184
+ >
185
+ {itemTitle.replace(/-/g, ' ')}
186
+ </Breadcrumbs.Item>
187
+ )
188
+ })}
187
189
  </Breadcrumbs>
188
190
  )}
189
191
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/doctocat-nextjs",
3
- "version": "0.0.0-20250626095112",
3
+ "version": "0.0.0-20250626102357",
4
4
  "description": "A Next.js theme for building Primer documentation sites",
5
5
  "main": "index.js",
6
6
  "type": "module",