From 6aabe0f3fcae2bba52e64149780dd737d430dca8 Mon Sep 17 00:00:00 2001 From: Bilal Catic Date: Thu, 20 Jun 2019 14:11:39 +0200 Subject: [PATCH] improve date picker, allow inline button --- .../src/components/DateRangePicker/index.js | 28 +++++++++++++------ .../src/scenes/PracticeSummaryReport/index.js | 2 +- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/client/src/components/DateRangePicker/index.js b/client/src/components/DateRangePicker/index.js index 74d23f7..afd7dd8 100644 --- a/client/src/components/DateRangePicker/index.js +++ b/client/src/components/DateRangePicker/index.js @@ -73,17 +73,25 @@ class DateRangePicker extends Component { render() { const { startDate, endDate, error, startDateLabel, endDateLabel } = this.state; + const { inlineButton } = this.props; const buttonLabel = this.props.buttonLabel || 'Save'; const startDateValue = startDate.format(defaultDateFormat); const endDateValue = endDate.format(defaultDateFormat); + const buttonRender = ( + + { inlineButton && } + {buttonLabel} + + ); + return (
- + - + - + + { + inlineButton && buttonRender + } { error && @@ -114,11 +125,12 @@ class DateRangePicker extends Component { } - - - {buttonLabel} - - + { + !inlineButton && + + {buttonRender} + + } ); diff --git a/client/src/scenes/PracticeSummaryReport/index.js b/client/src/scenes/PracticeSummaryReport/index.js index 70fa155..11feb47 100644 --- a/client/src/scenes/PracticeSummaryReport/index.js +++ b/client/src/scenes/PracticeSummaryReport/index.js @@ -52,7 +52,7 @@ class PracticeSummaryReport extends Component { - +