import { Meta, Preview, Props, Story } from "@storybook/addon-docs/blocks";
import { boolean, text, withKnobs } from "@storybook/addon-knobs";
import Modal from "../../Modal";
import { modalActions, modalTemplate } from "./Modal.data.js";

<Meta title="Modal" component={Modal} decorators={[withKnobs]} />

# Modal

Some MDX docs for the `Modal` component.

## Demo

<Preview>
  <Story name="Demo" parameters={{
    options: {
      showPanel: true
    }
  }}>
    {{
      components: {
        "h-modal": Modal,
      },
      props: {
        id: {
          default: text("id", "c-modal-id")
        },
        show: {
          default: boolean("show", false)
        },
      },
      data() {
        return {
          showModal: this.show
        }
      },
      template: `
        <div>
          <button @click.prevent="showModal = true">Open Modal</button>
          <h-modal :id="id" :show="showModal" @close="showModal = false" />
        </div>
      `,
      methods: {
        ...modalActions,
      },
      watch: {
        showIntenal(newValue) {
          this.showIntenal = newValue
        }
      },
    }}
  </Story>
</Preview>

## Props

<Props of={Modal} />
