Skip to content

Commit

Permalink
Merge pull request #1195 from Infineon/1194-storybook-code-snippet-ap…
Browse files Browse the repository at this point in the history
…pearing-twice-for-some-components

Storybook: fix the bug where snippet code in a stories appeared twice
  • Loading branch information
tishoyanchev authored Apr 25, 2024
2 parents 1ee2053 + 92b3c64 commit 0f8b8f4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/github_pages_storybook_preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ jobs:
});
}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
1 change: 0 additions & 1 deletion packages/components/src/components/modal/Development.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import * as ModalStories from './modal.stories';
<Canvas withSource="none">
<Story height="300px" of={ModalStories.Default}/>
</Canvas>
<Source dark="true" of={ModalStories.Default} />


<Controls />
Expand Down
11 changes: 11 additions & 0 deletions packages/components/src/components/navbar/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ export class Navbar {
}

componentWillLoad() {
this.RemoveSpaceOnStorybookSnippet()
const dropdownMenu = this.el.querySelector('ifx-navbar-menu')
const leftMenuItems = this.el.querySelectorAll('[slot="left-item"]')
if (!leftMenuItems.length && !dropdownMenu) {
Expand Down Expand Up @@ -396,6 +397,16 @@ export class Navbar {
}
}

RemoveSpaceOnStorybookSnippet() {
let parent = this.el.parentElement;
if(parent) {
let storybookWrapper = parent.closest('.css-xzp052');
if(storybookWrapper) {
storybookWrapper.style.overflow = 'visible'
}
}
}

render() {
return (
<div aria-label='a navigation navbar' class={`navbar__wrapper ${this.fixed ? 'fixed' : ""}`}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import * as TableStories from './table.stories';
<Story height="200px" of={TableStories.Default} />
</Canvas>

<Source dark="true" of={TableStories.Default} />


<Controls />

Expand Down

0 comments on commit 0f8b8f4

Please sign in to comment.