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 } from "../../utils";

import exampleImg from "../../assets/small-image.jpg";

export const Template = (args) => (
  <TransformWrapper {...normalizeArgs(args)}>
    <TransformComponent
      wrapperStyle={{ maxWidth: "100%", maxHeight: "calc(100vh - 50px)" }}
    >
      <div style={{ background: "#444", color: "white", padding: "50px" }}>
        <h1>No scrollbars needed</h1>
        <h2>Use mouse or gestures to move around</h2>
        <button
          onClick={() => alert("You can still interact with click events!")}
        >
          Click me!
        </button>
        <div
          style={{
            display: "flex",
            overflow: "auto",
            maxWidth: "100%",
            padding: "10px",
          }}
        >
          <div
            style={{
              width: "100px",
              height: "100px",
              padding: "10px",
              background: "red",
            }}
            className="panningDisabled"
          >
            Panning is DISABLED on this element
          </div>
          <div
            style={{
              width: "100px",
              height: "100px",
              padding: "10px",
              background: "blue",
            }}
            className="wheelDisabled"
          >
            Wheel is DISABLED on this element
          </div>
          <div
            style={{
              width: "100px",
              height: "100px",
              padding: "10px",
              background: "green",
            }}
            className="pinchDisabled"
          >
            Pinch is DISABLED on this element
          </div>
        </div>
        <p>
          Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
          eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
          minim veniam, quis nostrud exercitation ullamco laboris nisi ut
          aliquip ex ea commodo consequat. Duis aute irure dolor in
          reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
          pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
          culpa qui officia deserunt mollit anim id est laborum
        </p>
        <img src={exampleImg} alt="" />
        <p>
          Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
          eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
          minim veniam, quis nostrud exercitation ullamco laboris nisi ut
          aliquip ex ea commodo consequat. Duis aute irure dolor in
          reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
          pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
          culpa qui officia deserunt mollit anim id est laborum
        </p>
      </div>
    </TransformComponent>
  </TransformWrapper>
);

<Meta
  title="Examples/Mixed Content"
  component={TransformWrapper}
  argTypes={{
    ...argsTypes,
    "wheel.excluded": {
      ...argsTypes["wheel.excluded"],
      defaultValue: ["wheelDisabled"],
    },
    "panning.excluded": {
      ...argsTypes["panning.excluded"],
      defaultValue: ["panningDisabled"],
    },
    "pinch.excluded": {
      ...argsTypes["pinch.excluded"],
      defaultValue: ["pinchDisabled"],
    },
  }}
/>

# Mixed Content

<br />

### Preview:

<Canvas>
  <Story name="Mixed Content">{(args) => <Template {...args} />}</Story>
</Canvas>

## Component API

<ArgsTable story="Mixed Content" />
