react-zoom-pan-pinch
Version:
Zoom and pan html elements in easy way
44 lines (33 loc) • 1.02 kB
text/mdx
import { Meta, Story, ArgsTable, Canvas } from "@storybook/addon-docs/blocks";
import { action } from "@storybook/addon-actions";
import { TransformWrapper, TransformComponent } from "../../../components";
import { argsTypes } from "../../types/args.types.ts";
import { normalizeArgs, Controls } from "../../utils";
import exampleImg from "../../assets/big-image.jpeg";
export const Template = (args) => (
<TransformWrapper {...normalizeArgs(args)}>
{(utils) => (
<div>
<Controls {...utils} />
<TransformComponent
wrapperStyle={{ maxWidth: "100%", maxHeight: "calc(100vh - 50px)" }}
>
<img src={exampleImg} alt="" />
</TransformComponent>
</div>
)}
</TransformWrapper>
);
<Meta
title="Examples/Big Image"
component={TransformWrapper}
argTypes={argsTypes}
/>
<br />
<Canvas>
<Story name="Big Image">{(args) => <Template {...args} />}</Story>
</Canvas>
<ArgsTable story="Big Image" />