Skip to content

Commit

Permalink
Date selection and callback
Browse files Browse the repository at this point in the history
  • Loading branch information
RawToast committed Mar 30, 2018
1 parent e27fe66 commit f6efa94
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
5 changes: 2 additions & 3 deletions dokusho/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@
},
"scripts": {
"start": "react-scripts start",
"build": "toolbox react-scripts build",
"build": "react-toolbox-themr react-scripts build",
"test": "react-scripts test --env=jsdom",
"coverage": "react-scripts test --env=jsdom --coverage",
"ci": "react-scripts test --env=jsdom --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"eject": "react-scripts eject",
"prepare": "npm link bs-platform",
"clean": "rm -rf lib && rm -rf node_modules",
"toolbox": "react-toolbox-themr"
"clean": "rm -rf lib && rm -rf node_modules"
},
"devDependencies": {
"@astrada/reason-react-toolbox": "^0.4.2",
Expand Down
26 changes: 20 additions & 6 deletions dokusho/src/app/DateSelector.re
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
let component = ReasonReact.statelessComponent("DateSelector");
let component = ReasonReact.reducerComponent("DateSelector");

let make = (~today: string, _children) => {
let getDate = Js.Date.make;

let make = (~onChangeSelect, _children) => {
...component,
render: (_) =>
<div>
<ReactToolbox.DatePicker label="Today"/>
</div>
initialState: () => getDate(),
reducer: (state, _ext) =>
ReasonReact.Update({ state }),
render: (
{state, reduce}) =>
<div>
<ReactToolbox.DatePicker
label="Date"
value=(`Date(state))
onChange=((date, _mouse) =>
{
onChangeSelect(date);
(reduce(() => { date }))();
}
)/>
</div>
};
2 changes: 1 addition & 1 deletion dokusho/src/app/Dokusho.re
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module Dokusho {
/>
<PageTypeSelection onChangeSelect=(self.reduce(selected => ChangeSelection(selected))) />

<DateSelector today="" />
<DateSelector onChangeSelect=((a) => ()) />

<Entries entries=(List.hd(self.state.readingData.days).entries) />

Expand Down

0 comments on commit f6efa94

Please sign in to comment.