Skip to content

Commit

Permalink
fix: better story for datepicker
Browse files Browse the repository at this point in the history
  • Loading branch information
Grafikart committed Oct 30, 2023
1 parent e638ce9 commit 0ca6ec1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 29 deletions.
14 changes: 0 additions & 14 deletions src/components/datepicker/html/datepicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ function Datepicker({
format = 'YYYY-MM-DD',
onChange,
id,
min,
max,
label,
errors,
description,
Expand Down Expand Up @@ -113,18 +111,6 @@ function Datepicker({
{...extraProps}
/>
</div>
{/*
<DatepickerInput
id={id}
labelId={labelId}
readOnly={readOnly}
disabled={disabled}
value={value}
onChange={handleChange}
min={min}
max={max}
/>
*/}
<Errors errors={errors} activeId={id} />
</div>
);
Expand Down
35 changes: 20 additions & 15 deletions src/stories/date-picker/datepicker.stories.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import React from 'react';
import Orchestrator from '../utils/orchestrator';
import source from './source';
import data from './data';
import defaultArgTypes from '../utils/default-arg-types';
import LunaticDatepicker from '../../components/datepicker';
import { action } from '@storybook/addon-actions';

const stories = {
title: 'Components/DatePicker',
component: Orchestrator,
argTypes: defaultArgTypes,
export default {
title: 'Components/Datepicker',
component: LunaticDatepicker,
args: {
value: '1920-02-01',
format: 'YYYY-MM-DD',
handleChange: action('handleChange'),
response: { name: 'date' },
},
parameters: {
controls: { include: ['format', 'readOnly', 'disabled'] },
},
argTypes: {
format: { control: 'radio', options: ['YYYY-MM-DD', 'YYYY-MM', 'YYYY'] },
readOnly: { control: 'boolean' },
disabled: { control: 'boolean' },
},
};

export default stories;

const Template = (args) => <Orchestrator {...args} />;
export const Default = Template.bind({});

Default.args = { id: 'input', source, data, disabled: false, readOnly: false };
export const Basic = {};

0 comments on commit 0ca6ec1

Please sign in to comment.