import { Meta } from "@storybook/react";
import { SvgIconProps } from "./SvgIconProps";
import SvgIcon from "./SvgIcon";
import { linkedinIcon } from "@progress/kendo-svg-icons";
import { Colors } from "@/types/colors";

export default {
  title: "Design System/Common Utilities/Icons/SvgIcon",
  component: SvgIcon,
  tags: ["autodocs"],
  parameters: {
    docs: {
      description: {
        component:
          'The SvgIcon component is used to display svg icons. The KendoReact delivers more than 500 SVG icons. \n\n```javascript\nimport { SvgIcon } from "@renault-ui-library"\n```',
      },
    },
  },
  argTypes: {
    dataTestId: {
      control: { type: "text" },
      description: "Specifies the data-test-id attribute for testing purposes.",
    },
    className: {
      control: { type: "text" },
      description:
        "Specifies a list of CSS classes that will be added to the root DOM element.",
    },
    flip: {
      control: {
        type: "select",
        options: ["default", "horizontal", "vertical", "both"],
      },
      description: "Specifies the icon flip direction.",
    },
    icon: {
      control: {
        type: "object",
      },
      description: "Specifies the SVG icon.",
    },
    id: {
      control: { type: "text" },
      description: "Sets the id of the icon element.",
    },
    size: {
      control: {
        type: "select",
        options: [
          "default",
          "xsmall",
          "small",
          "medium",
          "large",
          "xlarge",
          "xxlarge",
          "xxxlarge",
        ],
      },
      description: "Specifies the size of the icon.",
    },
    style: {
      control: { type: "object" },
      description: "Sets additional CSS styles to the icon.",
    },
    svgClassName: {
      control: { type: "text" },
      description:
        "Specifies a list of CSS classes that will be added to the svg element.",
    },
    svgStyle: {
      control: { type: "object" },
      description: "Sets additional CSS styles to the svg element.",
    },
    tabIndex: {
      control: { type: "number" },
      description: "Sets the tabIndex of the icon element.",
    },
    themeColor: {
      control: {
        type: "select",
        options: Colors,
      },
      description: "Specifies the theme color of the Icon.",
    },
    viewBox: {
      control: { type: "text" },
      description: "Specifies the viewBox of the custom SVG icon.",
    },
  },
} as Meta;

export const Default = (args: SvgIconProps): JSX.Element => (
  <SvgIcon {...args} />
);

Default.args = {
  className: "",
  flip: "default",
  icon: linkedinIcon,
  dataTestId: "svgIcon-data-testid",
  size: "default",
  style: {},
  svgClassName: "",
  svgStyle: {},
  tabIndex: 0,
  themeColor: "inherit",
  viewBox: "",
};
