Skip to content

Commit a16dd50

Browse files
committed
clean up PR for review
1 parent e060403 commit a16dd50

File tree

6 files changed

+21
-19
lines changed

6 files changed

+21
-19
lines changed

src/components/NavSection.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export const NavSection = ({
2323
const isActive = sortedNavEntries.some((entry) => entry.id === activeItem)
2424

2525
let navItems = sortedNavEntries
26-
if (sectionId === 'components') {
26+
if (sectionId === 'components') {
27+
// only display unique entry.data.id in the nav list if the section is components
2728
navItems = [
2829
...sortedNavEntries
2930
.reduce((map, entry) => {

src/components/Navigation.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export const Navigation: React.FunctionComponent<NavigationProps> = ({
1313
const [activeItem, setActiveItem] = useState('')
1414

1515
useEffect(() => {
16-
setActiveItem(window.location.pathname.split('/').reverse()[0]) // won't work with tabs
16+
// TODO: Needs an alternate solution because of /tab in the path
17+
setActiveItem(window.location.pathname.split('/').reverse()[0])
1718
}, [])
1819

1920
const onNavSelect = (

src/content.config.ts

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

17-
// Todo: expand for other packages that remain under the react umbrella (Table, CodeEditor, etc)
17+
// TODO: Expand for other packages that remain under the react umbrella (Table, CodeEditor, etc)
1818
const tabMap: any = {
1919
'react-component-docs': 'react',
2020
'core-component-docs': 'html'
@@ -27,8 +27,7 @@ function defineContent(contentObj: CollectionDefinition) {
2727
section: z.string(),
2828
subsection: z.string().optional(),
2929
title: z.string().optional(),
30-
tab: z.string().optional().default(tabMap[name]),
31-
// package: z.string().optional().default(packageName as string)
30+
tab: z.string().optional().default(tabMap[name])
3231
}),
3332
})
3433
}

src/content.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
export const content = [
2-
{ base: 'textContent', pattern: '*.md', name: "textContent" },
3-
{
4-
"packageName":"@patternfly/react-core",
5-
"pattern":"**/examples/**/*.md", // had to update the pattern to bring in demos docs
6-
"name":"react-component-docs"
7-
},
8-
{
9-
"packageName":"@patternfly/patternfly",
10-
"pattern":"**/examples/**/*.md", // had to update the pattern to bring in demos docs
11-
"name":"core-component-docs"
12-
}
2+
{ base: 'textContent', pattern: '*.md', name: "textContent" }
3+
// TODO: Remove. Uncomment for local testing.
4+
// {
5+
// "packageName":"@patternfly/react-core",
6+
// "pattern":"**/examples/**/*.md", // had to update this pattern to bring in demos docs
7+
// "name":"react-component-docs"
8+
// },
9+
// {
10+
// "packageName":"@patternfly/patternfly",
11+
// "pattern":"**/examples/**/*.md", // had to update this pattern to bring in demos docs
12+
// "name":"core-component-docs"
13+
// }
1314
]

src/globals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export const componentTabs: any = {};
22

3-
export const tabNameMapping: any = {
3+
export const tabNames: any = {
44
'react': 'React',
55
'react-demos': 'React demos',
66
'react-deprecated': 'React deprecated',

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Title, PageSection, Content as PFContent } from '@patternfly/react-core
44
import MainLayout from '../../../layouts/Main.astro'
55
import { content } from "../../../content"
66
import { kebabCase } from 'change-case'
7-
import { componentTabs, tabNameMapping } from '../../../globals';
7+
import { componentTabs, tabNames } from '../../../globals';
88
99
export async function getStaticPaths() {
1010
const collections = await Promise.all(content.map(async (entry) => await getCollection(entry.name as 'textContent')))
@@ -91,7 +91,7 @@ const currentPath = Astro.url.pathname;
9191
class={`pf-v6-c-tabs__item${currentPath === `/${section}/${kebabCase(id)}/${tab}` ? ' pf-m-current' : ''}`}
9292
>
9393
<a class="pf-v6-c-tabs__link" href={`/${section}/${kebabCase(id)}/${tab}`}>
94-
{tabNameMapping[tab]}
94+
{tabNames[tab]}
9595
</a>
9696
</li>
9797
))}

0 commit comments

Comments
 (0)