forked from storybookjs/storybook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
127 changed files
with
2,960 additions
and
1,224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { extractArgTypes, extractComponentDescription } from './custom-elements'; | ||
import { sourceDecorator } from './sourceDecorator'; | ||
import { prepareForInline } from './prepareForInline'; | ||
import { SourceType } from '../../shared'; | ||
|
||
export const decorators = [sourceDecorator]; | ||
|
||
export const parameters = { | ||
docs: { | ||
extractArgTypes, | ||
extractComponentDescription, | ||
inlineStories: true, | ||
prepareForInline, | ||
source: { | ||
type: SourceType.DYNAMIC, | ||
language: 'html', | ||
}, | ||
}, | ||
}; |
19 changes: 19 additions & 0 deletions
19
addons/docs/src/frameworks/web-components/prepareForInline.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { StoryFn } from '@storybook/addons'; | ||
import React from 'react'; | ||
import { render } from 'lit-html'; | ||
|
||
export const prepareForInline = (storyFn: StoryFn) => { | ||
class Story extends React.Component { | ||
wrapperRef = React.createRef<HTMLElement>(); | ||
|
||
componentDidMount(): void { | ||
render(storyFn(), this.wrapperRef.current); | ||
} | ||
|
||
render(): React.ReactElement { | ||
return React.createElement('div', { ref: this.wrapperRef }); | ||
} | ||
} | ||
|
||
return (React.createElement(Story) as unknown) as React.CElement<{}, React.Component>; | ||
}; |
Oops, something went wrong.