Skip to content

Commit

Permalink
feat(date-picker-provider): useDatePickerProvider now also provide da…
Browse files Browse the repository at this point in the history
…tePickerState back
  • Loading branch information
wai-lin committed Aug 9, 2021
1 parent d446866 commit 75e2dd2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
13 changes: 6 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@ All notable changes to this project will be documented in this file. See [standa

## [0.2.0](https://github.com/wai-lin/react-hook-pickers/compare/v0.1.2...v0.2.0) (2021-08-08)

### 0.1.2 (2021-08-08)


### ⚠ BREAKING CHANGES

* **date-picker-provider:** default configs added in button props generator functions
- **date-picker-provider:** default configs added in button props generator functions

### Features

* **date-picker-provider:** new DatePickerProvider and useDatePickerProvider ([86df656](https://github.com/wai-lin/react-hook-pickers/commit/86df656a8ade6a4871ab5df074bbe845005c8e38))
* **usedatepicker:** useDatePicker hook for building the datepicker ([0631849](https://github.com/wai-lin/react-hook-pickers/commit/0631849fa2b9fd7053bcf6d447052d04f989d880))
- **date-picker-provider:** new DatePickerProvider and useDatePickerProvider ([86df656](https://github.com/wai-lin/react-hook-pickers/commit/86df656a8ade6a4871ab5df074bbe845005c8e38))

### 0.1.2 (2021-08-08)

- **usedatepicker:** useDatePicker hook for building the datepicker ([0631849](https://github.com/wai-lin/react-hook-pickers/commit/0631849fa2b9fd7053bcf6d447052d04f989d880))

### Bug Fixes

* **use-date-picker:** goToMonth func subtracting unnecessary 1 month ([530788d](https://github.com/wai-lin/react-hook-pickers/commit/530788d0b673034538317e670e880b050f1e7cc2))
- **use-date-picker:** goToMonth func subtracting unnecessary 1 month ([530788d](https://github.com/wai-lin/react-hook-pickers/commit/530788d0b673034538317e670e880b050f1e7cc2))
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import {

const ChildComponent = () => {
const {
datePickerState,
today,
getCalendarProps,
getCalendarViewControllers,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"size": "size-limit",
"analyze": "size-limit --why",
"commit": "git add . && cz",
"release": "standard-version"
"release": "npm run lint && npm run test && npm run build && standard-version"
},
"peerDependencies": {
"react": ">=16"
Expand Down
9 changes: 7 additions & 2 deletions src/components/DatePickerProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ interface DatePickerProviderProps {
}

const DatePickerContext = React.createContext<
ReturnType<typeof useDatePicker> | undefined
| ({ datePickerState: ReturnType<typeof useDatePickerState> } & ReturnType<
typeof useDatePicker
>)
| undefined
>(undefined)

const DatePickerProvider: React.FC<DatePickerProviderProps> = ({
Expand All @@ -16,7 +19,9 @@ const DatePickerProvider: React.FC<DatePickerProviderProps> = ({
const datePickerBlocks = useDatePicker(datePickerState)

return (
<DatePickerContext.Provider value={datePickerBlocks}>
<DatePickerContext.Provider
value={{ datePickerState, ...datePickerBlocks }}
>
{children}
</DatePickerContext.Provider>
)
Expand Down

0 comments on commit 75e2dd2

Please sign in to comment.