initial commit

This commit is contained in:
atanasster 2019-09-04 12:14:55 -04:00
parent 2b7fe51262
commit f460e8abb5
2 changed files with 10 additions and 1 deletions

View File

@ -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}>

View File

@ -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}>