@primer/doctocat-nextjs 0.0.0-20250626100459 → 0.0.0-20250626155740
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 +3 -3
- package/components/layout/root-layout/Theme.tsx +36 -37
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# @primer/doctocat-nextjs
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20250626155740
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- Fake entry to force publishing
|
|
8
8
|
|
|
9
|
-
## 0.
|
|
9
|
+
## 0.5.5
|
|
10
10
|
|
|
11
11
|
### Patch Changes
|
|
12
12
|
|
|
13
|
-
- [#52](https://github.com/primer/doctocat-nextjs/pull/52) [`
|
|
13
|
+
- [#52](https://github.com/primer/doctocat-nextjs/pull/52) [`dd67040`](https://github.com/primer/doctocat-nextjs/commit/dd670402d0c6f59ea919a741a1925ce72a5d966a) Thanks [@danielguillan](https://github.com/danielguillan)! - Fixes breadcrumbs with duplicate and missing items
|
|
14
14
|
|
|
15
15
|
## 0.5.4
|
|
16
16
|
|
|
@@ -149,46 +149,45 @@ export function Theme({pageMap, children}: ThemeProps) {
|
|
|
149
149
|
{activeHeaderLink ? activeHeaderLink.title : siteTitle}
|
|
150
150
|
</Breadcrumbs.Item>
|
|
151
151
|
)}
|
|
152
|
-
{activePath
|
|
153
|
-
|
|
152
|
+
{activePath
|
|
153
|
+
.filter((item, index, array) => {
|
|
154
|
+
const nextItem = array[index + 1]
|
|
154
155
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
+
!nextItem.frontMatter['tab-label']) ||
|
|
163
|
+
(item.name === 'index' && item.frontMatter['tab-label'])
|
|
164
|
+
)
|
|
165
|
+
})
|
|
166
|
+
.map((item, index, visibleItems) => {
|
|
167
|
+
const itemTitle = Array.isArray(item.children)
|
|
168
|
+
? item.children.find(child => child.name === 'index')?.frontMatter.title ||
|
|
169
|
+
item.frontMatter['tab-label'] ||
|
|
170
|
+
item.frontMatter.title ||
|
|
171
|
+
item.title
|
|
172
|
+
: item.frontMatter['tab-label'] || item.frontMatter.title || item.title
|
|
170
173
|
|
|
171
|
-
|
|
172
|
-
const itemTitle = item.frontMatter?.['tab-label'] || item.title
|
|
173
|
-
const isLastItem = index === items.length - 1
|
|
174
|
+
const isLastItem = index === visibleItems.length - 1
|
|
174
175
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
return acc
|
|
191
|
-
}, [] as React.ReactNode[])}
|
|
176
|
+
return (
|
|
177
|
+
<Breadcrumbs.Item
|
|
178
|
+
as={NextLink}
|
|
179
|
+
key={item.name}
|
|
180
|
+
href={item.route}
|
|
181
|
+
selected={isLastItem}
|
|
182
|
+
sx={{
|
|
183
|
+
textTransform: 'capitalize',
|
|
184
|
+
color: 'var(--brand-InlineLink-color-rest)',
|
|
185
|
+
}}
|
|
186
|
+
>
|
|
187
|
+
{itemTitle.replace(/-/g, ' ')}
|
|
188
|
+
</Breadcrumbs.Item>
|
|
189
|
+
)
|
|
190
|
+
})}
|
|
192
191
|
</Breadcrumbs>
|
|
193
192
|
)}
|
|
194
193
|
|