fix Zoom Props

This commit is contained in:
Tomas Nygren 2020-10-25 18:22:05 +11:00
parent 6e969b558a
commit f31bf0dc7c
2 changed files with 12 additions and 6 deletions

View File

@ -1,5 +1,5 @@
import window from 'global';
import React, { ReactElement, useEffect, useState } from 'react';
import React, { useEffect, useState } from 'react';
import { styled } from '@storybook/theming';
import ZoomIFrame, { IZoomIFrameProps } from './ZoomIFrame';
@ -20,8 +20,7 @@ const ZoomArea = styled.div<{ scale: number; height: number }>(({ scale = 1, hei
export type ZoomProps = {
scale: number;
children: ReactElement | ReactElement[] | Element | Element[];
} & IZoomIFrameProps;
} & Omit<IZoomIFrameProps, 'supportsCssZoom'>;
export function Zoom({ scale, children, src, title, allowFullScreen, active, id }: ZoomProps) {
const componentWrapperRef = React.useRef<HTMLDivElement>(null);

View File

@ -1,6 +1,6 @@
import React, { IframeHTMLAttributes } from 'react';
import { styled } from '@storybook/theming';
import { Zoom } from '@storybook/components';
import { ScrollArea, Spaced, Zoom } from '@storybook/components';
const StyledIframe = styled.iframe({
position: 'absolute',
@ -23,9 +23,16 @@ export interface IFrameProps {
}
export function IFrame(props: IFrameProps & IframeHTMLAttributes<HTMLIFrameElement>) {
const { active, id, title, src, allowFullScreen, ...rest } = props;
const { active, id, title, src, allowFullScreen, scale, ...rest } = props;
return (
<Zoom {...props}>
<Zoom
id={id}
title={title}
src={src}
allowFullScreen={allowFullScreen}
scale={scale}
active={active}
>
<StyledIframe
data-is-storybook={active ? 'true' : 'false'}
id={id}