Skip to content

Commit

Permalink
Merge pull request #2109 from ing-bank/feature/fix-development-tab
Browse files Browse the repository at this point in the history
fix Development tab
  • Loading branch information
okadurin authored Oct 23, 2023
2 parents 0eefce3 + ef69570 commit 9c86e82
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 182 deletions.
105 changes: 0 additions & 105 deletions src/components/ui-portal-categories.js

This file was deleted.

48 changes: 48 additions & 0 deletions src/pages/components/[component].astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
import { componentInfoEntries, getComponentEntry, getComponentGlob } from '../../content';
import MainLayout from "../../layouts/MainLayout.astro";
import ComponentLayout from "../../layouts/partials/ComponentPartial.astro";
import { UIPortalInpageNav } from "../../components/ui-portal-inpage-nav.js";
export async function getStaticPaths() {
return componentInfoEntries.map((entry) => ({
params: {
component: entry.data.component
},
props: { entry }
}));
}
const { entry } = Astro.props;
let config: any = {
component: entry.data.component,
// TODO remove this and update getComponentGlob so that it returns all found entities.
// Then we'll be able to extract headings for each of md file for the particular component
type: 'component-development'
};
// TODO here we need to concatenate multiple files under the component folder, excluding info.md
// At this moment there is only one file with such config in the "button" folder. That is why it works now
// TODO update getComponentEntry to getComponentEntries (plural). So that it gives all md files which we can render
// and then concatenate
const componentEntry = getComponentEntry(config);
const componentGlobs = await Astro.glob('/src/content/docs/components/**/*.md');
const componentGlob = getComponentGlob(componentGlobs, config);
const headers = componentGlob.getHeadings().filter(header => header.depth === 2);
console.log('headers: ', componentGlob.getHeadings());
const { Content } = await componentEntry.render();
const inPageNavData = headers.map(header => ({
name: header.text,
url: `/${componentEntry.slug}#${header.slug}`
}));
console.log('inPageNavData: ', inPageNavData)
---

<MainLayout title={entry.slug}>
<ComponentLayout frontmatter={entry.data}>
<UIPortalInpageNav nav-data={JSON.stringify(inPageNavData)} />
<Content/>
</ComponentLayout>
</MainLayout>

48 changes: 0 additions & 48 deletions src/pages/components/[component]/[page].astro

This file was deleted.

29 changes: 0 additions & 29 deletions src/pages/components/[component]/index.astro

This file was deleted.

0 comments on commit 9c86e82

Please sign in to comment.