Skip to content

Commit 134c12e

Browse files
authored
fix: placeholder for datepicker
fix: placeholder for datepicker
2 parents 1eb3759 + 4f8d273 commit 134c12e

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
"bump:minor": "yarn version --minor",
2121
"bump:major": "yarn version --major",
2222
"prepublish": "yarn lint && yarn test",
23-
"deploy-storybook": "storybook-to-ghpages"
23+
"deploy-storybook": "storybook-to-ghpages",
24+
"test:unit:output": "yarn test --json --outputFile=.jest.test.result.json",
25+
"start": "yarn test:unit:output && start-storybook -p 6006"
2426
},
2527
"lint-staged": {
2628
"{src}/**/*.ts*": [

src/components/DatePicker.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,19 @@ class DatePicker extends React.Component<Props, State> {
179179
};
180180

181181
public renderInputComponent = (): JSX.Element => {
182-
const { inputComponent, readOnly, disabled, clear, autoFocus, showDefaultIcon } = this.props;
182+
const { inputComponent, readOnly, disabled, clear, autoFocus, showDefaultIcon, placeholder } = this.props;
183183
const { inputValue } = this.state;
184184
const inputProps = {
185185
readOnly,
186186
autoFocus,
187187
disabled,
188188
clear,
189+
placeholder,
189190
onChange: this.handleInputChange,
190191
onClear: this.handleInputClear,
191192
onBlur: this.handleInputBlur,
192193
value: inputValue,
193-
icon: showDefaultIcon ? <SVGIcon id="calendar" /> : undefined,
194+
icon: showDefaultIcon ? <SVGIcon id="calendar" /> : undefined
194195
};
195196
return inputComponent ? inputComponent({ ...inputProps }) : <PickerInput {...inputProps} />;
196197
};

stories/DatePicker.stories.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ storiesOf('DatePicker', module)
3737
<DatePicker {...defaultProps} direction={0} />
3838
</div>
3939
);
40+
})
41+
.add('placeholder', () => {
42+
return <DatePicker {...defaultProps} placeholder="Select date" />;
4043
});
4144

4245
storiesOf('DatePicker - Input Props', module)

0 commit comments

Comments
 (0)