import {fn} from 'storybook/test'

import {FavoriteButton} from '../components/commerce/favorite-button'

import type {Meta, StoryObj} from '@storybook/react-vite'

const meta = {
  title: 'Commerce/FavoriteButton',
  component: FavoriteButton,
  parameters: {},
  tags: ['autodocs'],
  argTypes: {
    filled: {
      control: 'boolean',
    },
  },
  args: {
    onClick: fn(),
    filled: false,
  },
} satisfies Meta<typeof FavoriteButton>

export default meta
type Story = StoryObj<typeof meta>

export const Favorited: Story = {
  args: {
    filled: true,
    onClick: fn(),
  },
  render: ({onClick, filled}) => {
    return (
      <FavoriteButton
        filled={filled}
        onClick={() => {
          onClick?.()
        }}
      />
    )
  },
}

export const Unfavorited: Story = {
  args: {
    filled: false,
    onClick: fn(),
  },
  render: ({onClick, filled}) => {
    return (
      <FavoriteButton
        filled={filled}
        onClick={() => {
          onClick?.()
        }}
      />
    )
  },
}
