import React from 'react';
import { withKnobs, boolean } from '@storybook/addon-knobs';
import { mount } from 'enzyme';
import { expect } from 'chai';
import { describe, it, specs } from '../../storybook/facade';
import FilterDate from './index';

export default (stories) => {
	stories.addDecorator(withKnobs);

	stories.add('FilterDate', () => {
		const omit = boolean('Omit an Interval', true);

		const component = (
			<div
				style={{
					background: '#FFF',
					boxShadow: '0px 5px 15px 5px rgba(0, 0, 0, 0.05)',
					display: 'flex',
					justifyContent: 'flex-end'
				}}
			>
				<FilterDate
					omit={omit ? ['30'] : []}
					onChange={(value) => {
						console.log(`Selected the ${value} time interval`);
					}}
				/>
			</div>
		);

		specs(() => describe('FilterDate', () => {
			const wrapper = mount(component);

			it('Should be ok', () => {
				expect(wrapper).be.ok;
			});
		}));

		return component;
	});
};
