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 8f077fc
Showing 1 changed file with 3 additions and 5 deletions.
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 8f077fc

Please sign in to comment.