Skip to content

Commit

Permalink
feat(docs-page): wrap docs page content with CodeTabsProvider (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryce Kalow committed Feb 15, 2022
1 parent 5a4d375 commit f0bfe27
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/big-bikes-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hashicorp/react-docs-page': patch
---

Adds CodeTabsProvider to DocsPage, which is necessary for syncing language selection across multiple CodeTabs instances.
23 changes: 13 additions & 10 deletions packages/docs-page/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { AlgoliaConfigObject } from '@hashicorp/react-search/types'

import VersionSelect from '@hashicorp/react-version-select'
import { getVersionFromPath } from '@hashicorp/react-version-select/util'
import CodeTabsProvider from '@hashicorp/react-code-block/provider'
import { MDXProviderComponentsProp } from '@mdx-js/react'

import SearchBar from './components/search-bar'
Expand Down Expand Up @@ -131,16 +132,18 @@ export const DocsPageInner: FunctionComponent<DocsPageInnerProps> = ({
process.env.ENABLE_VERSIONED_DOCS === 'true',
})}
>
<Content
className="g-content" // used in temporary_injectJumpToSection
product={slug}
content={
<>
{isMobile ? null : search}
{children}
</>
}
/>
<CodeTabsProvider>
<Content
className="g-content" // used in temporary_injectJumpToSection
product={slug}
content={
<>
{isMobile ? null : search}
{children}
</>
}
/>
</CodeTabsProvider>
</div>
</div>
{/* if desired, show an "edit this page" link on the bottom right, linking to github */}
Expand Down

1 comment on commit f0bfe27

@vercel
Copy link

@vercel vercel bot commented on f0bfe27 Feb 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.