Skip to content

Commit

Permalink
Allow rendring no props to component
Browse files Browse the repository at this point in the history
  • Loading branch information
standeren committed Oct 30, 2024
1 parent b20b8b5 commit 8fc476b
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 62 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@ export function LibraryContent<T extends PageName = 'landingPage'>({
pages,
currentPage,
}: LibraryContentProps) {
const componentPropsAreExternal = currentPage !== 'landingPage';

const componentProps: Required<PagePropsMap>[T] =
componentPropsAreExternal && (pages[currentPage].props as Required<PagePropsMap>[T]);
const componentProps: Required<PagePropsMap>[T] = pages[currentPage]
?.props as Required<PagePropsMap>[T];

return (
<div className={classes.libraryContent}>
<PagesRouter pageNames={getAllPageNamesFromPagesConfig(pages)} />
<div className={classes.component}>
<Component {...componentProps} />
<Component {...(componentProps ?? {})} />
</div>
<InfoBox pageName={currentPage} />
</div>
Expand Down

0 comments on commit 8fc476b

Please sign in to comment.