Skip to content

Commit

Permalink
docs: add typings to some examples (#2231)
Browse files Browse the repository at this point in the history
* Update navigation.mdx

Used strongly-typed useState<Date>(...) hook

* Update selection-modes.mdx

Used strongly-typed useState<Date>(...) hook

* Update start.mdx

Used strongly-typed useState<Date>(...) hook

* Update README.md

Used strongly-typed useState<Date>(...) hook

* Update README.md

Date can also be undefined

Co-authored-by: Giampaolo Bellavite <[email protected]>

* Update website/docs/start.mdx

Date can also be undefined

Co-authored-by: Giampaolo Bellavite <[email protected]>

* Update website/docs/using-daypicker/navigation.mdx

Removed unneeded typing

Co-authored-by: Giampaolo Bellavite <[email protected]>

* Update website/docs/using-daypicker/selection-modes.mdx

Added Date array type

Co-authored-by: Giampaolo Bellavite <[email protected]>

* Update website/docs/using-daypicker/selection-modes.mdx

Removed unneeded/obvious typing

Co-authored-by: Giampaolo Bellavite <[email protected]>

---------

Co-authored-by: Giampaolo Bellavite <[email protected]>
Co-authored-by: Giampaolo Bellavite <[email protected]>
  • Loading branch information
3 people authored Jul 7, 2024
1 parent 9e814ae commit 33daf06
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { DayPicker } from "react-day-picker";
import "react-day-picker/dist/style.css";

function MyDatePicker() {
const [selected, setSelected] = useState();
const [selected, setSelected] = useState<Date | undefined>();
return <DayPicker mode="single" selected={selected} onSelect={setSelected} />;
}
```
Expand Down
2 changes: 1 addition & 1 deletion website/docs/start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { DayPicker } from "react-day-picker";
import "react-day-picker/style.css";

export function MyDatePicker() {
const [selected, setSelected] = useState();
const [selected, setSelected] = useState<Date | undefined>();
return <DayPicker mode="single" selected={selected} onSelect={setSelected} />;
}
```
Expand Down
2 changes: 1 addition & 1 deletion website/docs/using-daypicker/selection-modes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ import { useState } from "react";
import { DayPicker } from "react-day-picker";

export function App() {
const [selected, setSelected] = useState();
const [selected, setSelected] = useState<Date[] | undefined>();
const handleSelect = (newSelected) => {
// Update the selected dates
setSelected(newSelected);
Expand Down

0 comments on commit 33daf06

Please sign in to comment.