import type { Meta, StoryObj } from "@storybook/react";
import type { LinkButtonProps } from "./LinkButton";
import { LinkButton } from "./LinkButton";
import { excludeControls } from "../../utils";

type StoryType = StoryObj<typeof LinkButton>;

const meta: Meta<typeof LinkButton> = {
  title: "Components/LinkButton",
  component: LinkButton,
  argTypes: {
    target: {
      options: ["_self", "_blank", "_parent", "_top"],
      control: { type: "select" },
    },
    to: {
      control: { type: "text" },
    },
    title: {
      control: { type: "text" },
    },
    download: {
      control: { type: "boolean" },
    },
    rel: {
      options: ["noopener noreferrer", "canonical", "nofollow"],
      control: { type: "select" },
    },
    ...excludeControls("style"),
  },
};

export const Default: StoryType = {
  render: (args: LinkButtonProps) => (
    <LinkButton {...args}>LinkButton text</LinkButton>
  ),
  args: {
    href: "https://www.google.com",
    to: "",
    title: "",
    size: "md",
    download: false,
    isDisabled: false,
    isSuccess: false,
    isLoading: false,
    role: "",
  },
};

export default meta;
