mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-09 00:19:13 +08:00
initial commit
This commit is contained in:
parent
2b7fe51262
commit
f460e8abb5
@ -1,6 +1,7 @@
|
||||
/* eslint-disable react/destructuring-assignment */
|
||||
|
||||
import React from 'react';
|
||||
import document from 'global';
|
||||
import { MDXProvider } from '@mdx-js/react';
|
||||
import { ThemeProvider, ensure as ensureTheme } from '@storybook/theming';
|
||||
import { DocsWrapper, DocsContent, Source } from '@storybook/components';
|
||||
@ -49,6 +50,13 @@ export const DocsContainer: React.FunctionComponent<DocsContainerProps> = ({
|
||||
const theme = ensureTheme(options.theme);
|
||||
const { components: userComponents = null } = parameters.docs || {};
|
||||
const components = { ...defaultComponents, ...userComponents };
|
||||
|
||||
React.useEffect(() => {
|
||||
const element = document.getElementById(context.id);
|
||||
if (element) {
|
||||
element.scrollIntoView(true);
|
||||
}
|
||||
}, [context.selectedStory]);
|
||||
return (
|
||||
<DocsContext.Provider value={context}>
|
||||
<ThemeProvider theme={theme}>
|
||||
|
@ -49,10 +49,11 @@ const InlineZoomWrapper: React.FC<{ scale: number }> = ({ scale, children }) =>
|
||||
};
|
||||
|
||||
const InlineStory: React.FunctionComponent<InlineStoryProps> = ({
|
||||
id,
|
||||
storyFn: ReactStory,
|
||||
height,
|
||||
}) => (
|
||||
<div style={{ height }}>
|
||||
<div style={{ height }} id={id}>
|
||||
<ZoomContext.Consumer>
|
||||
{({ scale }) => (
|
||||
<InlineZoomWrapper scale={scale}>
|
||||
|
Loading…
x
Reference in New Issue
Block a user