From 38f54827a8d67cde89b279ceca6a153c67dfd8a0 Mon Sep 17 00:00:00 2001 From: Tatiana Tkachenko Date: Sun, 1 Apr 2018 10:29:37 +0300 Subject: [PATCH 1/6] Added today button handler --- lib/src/_shared/ModalDialog.d.ts | 1 + lib/src/_shared/ModalDialog.jsx | 26 +++++++++++++++++++++++++- lib/src/_shared/PickerBase.jsx | 4 ++++ lib/src/wrappers/ModalWrapper.d.ts | 1 + lib/src/wrappers/ModalWrapper.jsx | 24 +++++++++++++++++++++++- 5 files changed, 54 insertions(+), 2 deletions(-) diff --git a/lib/src/_shared/ModalDialog.d.ts b/lib/src/_shared/ModalDialog.d.ts index 0ed1d9a4e..09744390b 100644 --- a/lib/src/_shared/ModalDialog.d.ts +++ b/lib/src/_shared/ModalDialog.d.ts @@ -8,6 +8,7 @@ export interface DateTextFieldProps extends DialogProps { onAccept: ButtonProps['onClick']; onDismiss: ButtonProps['onClick']; onClear: ButtonProps['onClick']; + onSetToday: ButtonProps['onClick']; dialogContentClassName?: string; invalidLabel?: string; okLabel?: ReactNode; diff --git a/lib/src/_shared/ModalDialog.jsx b/lib/src/_shared/ModalDialog.jsx index fdcb4783a..92ab5a854 100644 --- a/lib/src/_shared/ModalDialog.jsx +++ b/lib/src/_shared/ModalDialog.jsx @@ -29,6 +29,11 @@ const styles = { marginRight: 'auto', }, }, + todayDialogAction: { + '&:first-child': { + marginRight: 'auto', + }, + }, dialogAction: { // empty but may be needed for override }, @@ -40,11 +45,14 @@ const ModalDialog = ({ onAccept, onDismiss, onClear, + onSetToday, okLabel, cancelLabel, clearLabel, + todayLabel, dialogContentClassName, clearable, + showTodayButton, ...other }) => ( @@ -55,7 +63,10 @@ const ModalDialog = ({ { clearable && @@ -68,6 +79,16 @@ const ModalDialog = ({ } + { !clearable && showTodayButton && + + } +