import { html, TemplateResult } from 'lit';
import '../src/nile-button';

export default {
  title: 'NileButton',
  component: 'nile-button',
  argTypes: {
    title: { control: 'text' },
    counter: { control: 'number' },
    textColor: { control: 'color' },
  },
};

interface Story<T> {
  (args: T): TemplateResult;
  args?: Partial<T>;
  argTypes?: Record<string, unknown>;
}

interface ArgTypes {
  name?: string;
  counter?: number;
  textColor?: string;
  slot?: TemplateResult;
}

const Template: Story<ArgTypes> = ({
  name = 'Primary',
  counter = 5,
  textColor,
  slot,
}: ArgTypes) => html`
  <nile-button
    style="--nile-elements-text-color: ${textColor || 'black'}"
    .name=${name}
    .counter=${counter}
  >
    ${slot}
  </nile-button>
`;

export const Regular = Template.bind({});

export const CustomTitle = Template.bind({});
CustomTitle.args = {
  name: 'Primary',
};

export const CustomCounter = Template.bind({});
CustomCounter.args = {
  counter: 123456,
};

export const SlottedContent = Template.bind({});
SlottedContent.args = {
  slot: html`<p>Slotted content</p>`,
};
SlottedContent.argTypes = {
  slot: { table: { disable: true } },
};
