11import './index.css' ;
2- import React , { PropTypes } from 'react' ;
2+ import React from 'react' ;
33import DatePicker from './DatePicker.js' ;
44import Modal from './Modal.js' ;
55
6+ type EnhanceDatePickerProps < T > = T & {
7+ isOpen : boolean ,
8+ }
69
7- function EnhanceDatePicker ( { isOpen, ...props } ) {
10+ function EnhanceDatePicker < T : * > ({ isOpen , ...props } : EnhanceDatePickerProps < T > ) {
811 function onModalClose ( event ) {
912 if ( event . target === event . currentTarget ) {
1013 props . onCancel ( ) ;
@@ -21,8 +24,11 @@ function EnhanceDatePicker({ isOpen, ...props }) {
2124 ) ;
2225}
2326
27+ type ModalDatePickerProps< T > = T & {
28+ isPopup : boolean ,
29+ }
2430
25- function ModalDatePicker ( { isPopup, ...props } ) {
31+ function ModalDatePicker< T : * > ({ isPopup , ...props } : ModalDatePickerProps < T > ) {
2632 if ( ! isPopup ) {
2733 return < DatePicker { ...props } /> ;
2834 }
@@ -34,20 +40,6 @@ function ModalDatePicker({ isPopup, ...props }) {
3440 );
3541}
3642
37- ModalDatePicker . propTypes = {
38- isPopup : PropTypes . bool ,
39- isOpen : PropTypes . bool ,
40- theme : PropTypes . string ,
41- value : PropTypes . object ,
42- min : PropTypes . object ,
43- max : PropTypes . object ,
44- dateFormat : PropTypes . array ,
45- confirmText : PropTypes . string ,
46- cancelText : PropTypes . string ,
47- onSelect : PropTypes . func ,
48- onCancel : PropTypes . func ,
49- } ;
50-
5143ModalDatePicker . defaultProps = {
5244 isPopup : true ,
5345 isOpen : false ,
0 commit comments