import React from 'react';
import { storiesOf } from '@storybook/react';
import AddToCart from './index';
import { State, Store } from '@sambego/storybook-state';
import { t } from 'Framework/i18n';

function onPress() {}

const store = new Store({
    note: 'Bitte wie immer produzieren',
});

function handleChange(event) {
    store.set({ note: event.target.value });
}

storiesOf('AddToBasket', module)
    .add('with active button', () => (
        <State store={store}>
            {state => [
                <AddToCart
                    key={state.note}
                    note={state.note}
                    noteLabel={t('amountPrice.notice')}
                    buttonLabel={t('amountPrice.intoCart')}
                    onPress={onPress}
                    handleChange={handleChange}
                />,
            ]}
        </State>
    ))
    .add('with disabled button', () => (
        <AddToCart
            noteLabel={t('amountPrice.notice')}
            note=""
            buttonLabel={t('amountPrice.intoCart')}
            disabled
        />
    ));
