Skip to content

Commit

Permalink
fix(DateInput): disabled styles aren't applied to date-picker
Browse files Browse the repository at this point in the history
  • Loading branch information
lesha1201 committed May 15, 2019
1 parent 54210d6 commit 7fd7112
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 33 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 2 additions & 4 deletions e2e/__tests__/date-input.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ const SUITES = [
await input.type('01/01/2019');
}),
baisy.suite('Components/DateInput', 'common', 'open datetime')
.setRootHeight(500)
.setRootHeight(600)
.setEnhancer(async (iframe) => {
const input = await iframe.waitForXPath('(//input)[2]');
const input = await iframe.waitForXPath('(//input)[5]');

await input.click();
await input.type('01/01/2019, 12:00 PM');

await (await iframe.waitForXPath('//input')).click();
await input.click();
Expand All @@ -29,4 +28,3 @@ const SUITES = [
SUITES.map(suite => {
it(suite.getTestName(), suite.testStory, 20000);
});

41 changes: 24 additions & 17 deletions src/components/DateInput/DateInput.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,29 @@ import React from 'react';

export default (asStory) => {
asStory('Components/DateInput', module, (story, { DateInput, Column, StateContainer }) => {
story
.add('common', () => (
<Column>
<StateContainer value={ null }>
<DateInput placeholder="mm/dd/yyyy" />
</StateContainer>
<StateContainer value={ null }>
<DateInput withTime />
</StateContainer>
<StateContainer value="2018-11-07">
<DateInput clearable />
</StateContainer>
<StateContainer value="2018-11-29T21:00:00.000Z">
<DateInput withTime clearable />
</StateContainer>
</Column>
));
story.add('common', () => (
<Column>
<StateContainer value={ null }>
<DateInput placeholder="mm/dd/yyyy" />
</StateContainer>
<StateContainer value={ null }>
<DateInput withTime />
</StateContainer>
<StateContainer value="2018-11-07">
<DateInput clearable />
</StateContainer>
<StateContainer value="2018-11-29T21:00:00.000Z">
<DateInput withTime clearable />
</StateContainer>
<StateContainer value="2018-11-15T21:00:00.000Z">
<DateInput
minDate={ new Date('2018-11-15T21:00:00.00+03:00') }
minTime={ new Date('2018-11-15T00:00:00.00+03:00') }
maxTime={ new Date('2018-11-15T02:00:00.00+03:00') }
withTime
/>
</StateContainer>
</Column>
));
});
};
24 changes: 12 additions & 12 deletions src/components/DateInput/DateInput.theme.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { createThemeTag } from '../../theme/createThemeTag';


// eslint-disable-next-line
const [_, theme] = createThemeTag('dateInput', ({ COLORS }: *) => ({
globals: `
Expand All @@ -11,12 +10,6 @@ const [_, theme] = createThemeTag('dateInput', ({ COLORS }: *) => ({
padding-bottom: 32px;
}
.react-datepicker__time-list-item {
align-items: center;
display: flex;
justify-content: center;
}
.react-datepicker__header,
.react-datepicker__today-button {
background-color: ${COLORS.LIGHT_GRAY5};
Expand Down Expand Up @@ -61,7 +54,7 @@ const [_, theme] = createThemeTag('dateInput', ({ COLORS }: *) => ({
.react-datepicker__day--selected {
border-radius: 24px;
background-color: ${COLORS.LIGHT_BLUE};
color: ${COLORS.PRIMARY_TEXT_COLOR};
color: ${COLORS.LIGHT_PRIMARY_TEXT_COLOR};
}
.react-datepicker__day:hover {
Expand Down Expand Up @@ -166,10 +159,17 @@ const [_, theme] = createThemeTag('dateInput', ({ COLORS }: *) => ({
border-left-color: ${COLORS.PRIMARY_TEXT_COLOR};
outline: none;
}
.react-datepicker__navigation--next--with-time {
right: 80px;
}
/* Disabled modifier */
.react-datepicker__day--disabled,
.react-datepicker__time-list-item--disabled {
color: ${COLORS.DISABLED_TEXT_COLOR};
}
`,
}));

export {
theme,
};

export { theme };

0 comments on commit 7fd7112

Please sign in to comment.