@primer/doctocat-nextjs 0.5.4 → 0.5.5-rc.5575e44
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 +6 -0
- package/components/layout/root-layout/Theme.tsx +37 -16
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @primer/doctocat-nextjs
|
|
2
2
|
|
|
3
|
+
## 0.5.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
|
|
3
9
|
## 0.5.4
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -149,22 +149,43 @@ export function Theme({pageMap, children}: ThemeProps) {
|
|
|
149
149
|
{activeHeaderLink ? activeHeaderLink.title : siteTitle}
|
|
150
150
|
</Breadcrumbs.Item>
|
|
151
151
|
)}
|
|
152
|
-
{activePath
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
152
|
+
{activePath
|
|
153
|
+
.filter((item, index, array) => {
|
|
154
|
+
const nextItem = array[index + 1]
|
|
155
|
+
|
|
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) => {
|
|
170
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
171
|
+
const itemTitle = item.frontMatter?.['tab-label'] || item.title
|
|
172
|
+
const isLastItem = index === visibleItems.length - 1
|
|
173
|
+
|
|
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
|
+
})}
|
|
168
189
|
</Breadcrumbs>
|
|
169
190
|
)}
|
|
170
191
|
|