Skip to content

Commit

Permalink
replace main.extraContent theme option with main option (#886)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaMachina committed Oct 20, 2022
1 parent c28a7f2 commit 2533a6c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/nasty-apples-breathe.md
@@ -0,0 +1,5 @@
---
'nextra-theme-docs': patch
---

replace `main.extraContent` theme option with `main` option
3 changes: 1 addition & 2 deletions packages/nextra-theme-docs/src/constants.tsx
Expand Up @@ -83,7 +83,6 @@ export const DEFAULT_THEME: DocsThemeConfig = {
</>
),
logoLink: true,
main: {},
navbar: Navbar,
navigation: {
next: true,
Expand Down Expand Up @@ -161,7 +160,7 @@ export const DEEP_OBJECT_KEYS = Object.entries(DEFAULT_THEME)

export const LEGACY_CONFIG_OPTIONS: Record<string, string> = {
bannerKey: 'banner.key',
bodyExtraContent: 'main.extraContent',
bodyExtraContent: 'main',
customSearch: 'search.component',
defaultMenuCollapsed: 'sidebar.defaultMenuCollapsed',
feedbackLabels: 'feedback.labels',
Expand Down
5 changes: 3 additions & 2 deletions packages/nextra-theme-docs/src/index.tsx
Expand Up @@ -97,15 +97,16 @@ const Body = ({
<div className="mt-16" />
)

const body = (
const content = (
<>
{children}
{gitTimestampEl}
{navigation}
{renderComponent(config.main.extraContent)}
</>
)

const body = config.main?.({ children: content }) || content

if (themeContext.layout === 'full') {
return (
<article className="min-h-[calc(100vh-4rem)] w-full overflow-x-hidden pl-[max(env(safe-area-inset-left),1.5rem)] pr-[max(env(safe-area-inset-right),1.5rem)]">
Expand Down
4 changes: 1 addition & 3 deletions packages/nextra-theme-docs/src/types.ts
Expand Up @@ -54,9 +54,7 @@ export interface DocsThemeConfig {
i18n: { direction?: string; locale: string; text: string }[]
logo: ReactNode | FC
logoLink?: boolean | string
main: {
extraContent?: ReactNode | FC
}
main?: FC<{ children: ReactNode }>
navbar: ReactNode | FC<NavBarProps>
navigation:
| boolean
Expand Down

0 comments on commit 2533a6c

Please sign in to comment.