Skip to content

Commit

Permalink
fix: πŸ› CalendarInputOnly clear button disabled with field
Browse files Browse the repository at this point in the history
The SQFormDatePickerCalendarInputOnly field's "clear" button is now
disabled if the field itself is dsiabled

βœ… Closes: #154
  • Loading branch information
20BBrown14 committed Mar 25, 2021
1 parent a69f204 commit 1380104
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function SQFormDatePickerWithCalendarInputOnly({
<IconButton
classes={clearButtonClasses}
onClick={clearField}
disabled={!values[name]}
disabled={isDisabled || !values[name]}
>
<ClearIcon color="disabled" fontSize="small" />
</IconButton>
Expand Down
10 changes: 7 additions & 3 deletions stories/SQFormDatePickerWithCalendarInputOnly.stories.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import {withKnobs} from '@storybook/addon-knobs';
import {withKnobs, boolean} from '@storybook/addon-knobs';
import {withInfo} from '@storybook/addon-info';
import * as Yup from 'yup';
import {SQForm, SQFormDatePickerWithCalendarInputOnly} from '../src';
Expand All @@ -10,7 +10,7 @@ export default {
};

const MOCK_INITIAL_STATE = {
date: ''
date: '12/01/1990'
};

const handleSubmit = (values, actions) => {
Expand All @@ -32,7 +32,11 @@ export const basicDatePicker = () => {
onSubmit={handleSubmit}
validationSchema={basicSchema}
>
<SQFormDatePickerWithCalendarInputOnly name="date" label="Date" />
<SQFormDatePickerWithCalendarInputOnly
name="date"
label="Date"
isDisabled={boolean('Date Picker Disabled', false)}
/>
</SQForm>
);
};
Expand Down

0 comments on commit 1380104

Please sign in to comment.