import preview from "../../.storybook/preview.tsx";
import { ShareButton } from "./ShareButton.tsx";
import { test } from "./test.css.ts";

const meta = preview.meta({
  title: "Components/Share Button",
  component: ShareButton,
  tags: ["autodocs"],
  args: {
    shareLabel: "Share data",
    copyLabel: "Copy to clipboard",
    shareData: { url: "https://example.com", title: "Example URL" },
  },
});

/**
 * The default case.
 */
export const Default = meta.story({
  args: {},
});

/**
 * Enforce use of copy to clipboard.
 */
export const WebShareDisabled = meta.story({
  args: {
    webShare: false,
  },
});

/**
 * Allows overriding revert after milliseconds timer.
 */
export const RevertAfterOverride = meta.story({
  args: {
    revertAfterMs: 5000,
  },
});

/**
 * Manually supplying disabled overrides internal button state.
 */
export const Disabled = meta.story({
  args: {
    disabled: true,
  },
});

/**
 * Passes along arbitrary props to the underlying button component.
 */
export const PassesProps = meta.story({
  args: {
    className: test,
    style: { fontFamily: "cursive", padding: "1rem 2rem" },
  },
});
