Skip to content

Commit

Permalink
fix(code-block): fix language-undefined in MDX CodeTabs (#768)
Browse files Browse the repository at this point in the history
* fix: fix language-undefined in MDX CodeTabs

* chore(code-block): add changeset
  • Loading branch information
zchsh authored and alexcarpenter committed Oct 21, 2022
1 parent 9df3c87 commit bbb6233
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changeset/itchy-flowers-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hashicorp/react-code-block': patch
---

Fixes issue where code-tabs in MDX would render blocks with a language-undefined className, even if the className was in fact defined.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions packages/code-block/partials/code-tabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,6 @@ function CodeTabs({
{validChildren.map((tabChild, idx) => {
const isActive = idx == activeTabIdx
const clonedChild = React.cloneElement(tabChild, {
// Note: wipes any custom classNames on the tabChild.
// This is intentional, for example, it removes
// any margin set in MDX custom components
className: s.tabChild,
hasBarAbove: true, // removes margin, and top border rounding, for better UI fit
theme, // ensures theme of child code blocks in JSX matches tabs theme
})
Expand Down

0 comments on commit bbb6233

Please sign in to comment.