From 563eb2322b3c2ff84b4c7b536ee3980e79286947 Mon Sep 17 00:00:00 2001 From: Patrick Browne Date: Wed, 20 Nov 2019 17:04:11 +0100 Subject: [PATCH] feat: Implement DateMonthPicker --- docs/styleguide.config.js | 3 +- react/DateMonthPicker/Readme.md | 32 ++++++++ react/DateMonthPicker/index.jsx | 111 +++++++++++++++++++++++++++ react/DateMonthPicker/index.spec.jsx | 67 ++++++++++++++++ react/DateMonthPicker/styles.styl | 37 +++++++++ 5 files changed, 249 insertions(+), 1 deletion(-) create mode 100644 react/DateMonthPicker/Readme.md create mode 100644 react/DateMonthPicker/index.jsx create mode 100644 react/DateMonthPicker/index.spec.jsx create mode 100644 react/DateMonthPicker/styles.styl diff --git a/docs/styleguide.config.js b/docs/styleguide.config.js index adec6f2e05..e8dbc2728a 100644 --- a/docs/styleguide.config.js +++ b/docs/styleguide.config.js @@ -40,7 +40,8 @@ module.exports = { '../react/SelectBox/SelectBox.jsx', '../react/Textarea/index.jsx', '../react/Toggle/index.jsx', - '../react/FileInput/index.jsx' + '../react/FileInput/index.jsx', + '../react/DateMonthPicker/index.jsx' ] }, { diff --git a/react/DateMonthPicker/Readme.md b/react/DateMonthPicker/Readme.md new file mode 100644 index 0000000000..46f6c70b48 --- /dev/null +++ b/react/DateMonthPicker/Readme.md @@ -0,0 +1,32 @@ +``` +import I18n from 'cozy-ui/transpiled/react/I18n'; +import DateMonthPicker from 'cozy-ui/transpiled/react/DateMonthPicker'; +import Stack from 'cozy-ui/transpiled/react/Stack'; +import Button from 'cozy-ui/transpiled/react/Button'; +import Modal from 'cozy-ui/transpiled/react/Modal'; + + +const dictRequire = x => ({}) +const initialState = { choosing: isTesting(), monthDate: '2019-08' } +const showPicker = () => setState({ choosing: true }); +const hidePicker = () => setState({ choosing: false }); +const handleSelect = monthDate => { + setState({ monthDate }) + hidePicker() +} + + + + Month chosen: { state.monthDate ? state.monthDate : 'No date chosen yet'}
+