import { Story, Meta } from '@storybook/react';
import { Link } from './link';
import type { LinkProps } from './link';

export default {
  component: Link,
  title: 'Table/In Cells/Link',
  argTypes: {
    children: {
      description: 'The component which display the link.'
    },
    href: {
      description: 'The href the link will address to.'
    },
    table: {
      description: 'Show special styles for table link.'
    }
  }
} as Meta;

const onClick = () => alert('Click handler');

const Template: Story<LinkProps> = args => <Link {...args} />;

export const Primary = Template.bind({});
Primary.args = {
  children: 'Link',
  href: '',
  table: false,
  onClick
};

export const TableLink = Template.bind({});
TableLink.args = {
  children: 'Table Link',
  href: '/',
  table: true,
  onClick
};

export const ExternalLink = Template.bind({});
ExternalLink.args = {
  children: 'External Link',
  href: 'https://example.com',
  table: true,
  onClick
};
