Skip to content

Commit 7db63cc

Browse files
committed
clean up some commented code
1 parent f036260 commit 7db63cc

File tree

4 files changed

+7
-14
lines changed

4 files changed

+7
-14
lines changed

src/components/NavSection.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,7 @@ export const NavSection = ({
2727
navItems = [
2828
...sortedNavEntries
2929
.reduce((map, entry) => {
30-
if (
31-
!map.has(entry.data.id) ||
32-
(entry.data?.tab === 'react' &&
33-
map.has(entry.data.id) &&
34-
map.get(entry.data.id).data.tab === 'html')
35-
) {
30+
if (!map.has(entry.data.id)) {
3631
map.set(entry.data.id, entry)
3732
}
3833
return map

src/content.config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ function defineContent(contentObj: CollectionDefinition) {
1414
return
1515
}
1616

17+
// Todo: expand to cover deprecated & demos tabs (look in filepath, or enforce tab in frontmatter for nonstandard tabs)
1718
const tabMap: any = {
18-
'react-component-docs': 'react', // look in filepath for demos, look for deprecated flag or source flag for dep
19-
'core-component-docs': 'html' // or force tab in frontmatter for non-base tabs
19+
'react-component-docs': 'react',
20+
'core-component-docs': 'html'
2021
};
2122

2223
return defineCollection({

src/content.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,10 @@ export const content = [
44
"packageName":"@patternfly/react-core",
55
"pattern":"**/components/**/*.md",
66
"name":"react-component-docs"
7-
// "build": {
8-
// "format": "directory"
9-
// }
107
},
118
{
129
"packageName":"@patternfly/patternfly",
1310
"pattern":"**/components/**/*.md",
1411
"name":"core-component-docs"
15-
// "build": {
16-
// "format": "directory"
17-
// }
1812
}
1913
]

src/pages/[section]/[page]/[...tab].astro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export async function getStaticPaths() {
1010
const collections = await Promise.all(content.map(async (entry) => await getCollection(entry.name as 'textContent')))
1111
1212
const flatCol = collections.flat().map((entry) => {
13+
// Build tabs dictionary
1314
// if no dictionary entry exists, and tab data exists
1415
if(componentTabs[entry.data.id] === undefined && entry.data.tab) {
1516
componentTabs[entry.data.id] = [entry.data.tab];
@@ -48,6 +49,8 @@ export async function getStaticPaths() {
4849
return s1Index > s2Index ? 1 : -1;
4950
}
5051
52+
// Sort tabs entries based on above sort order
53+
// Ensures all tabs are displayed in a consistent order & which tab gets displayed for a component route without a tab
5154
Object.values(componentTabs).map((tabs: any) => {
5255
tabs.sort(sortSources)
5356
})

0 commit comments

Comments
 (0)