-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DateRange: add readonly optinal prop to DateRange component (web) (#3851
- Loading branch information
1 parent
ebaabc9
commit 65dfc70
Showing
4 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { useState } from 'react'; | ||
import { Flex } from 'gestalt'; | ||
import { DateRange } from 'gestalt-datepicker'; | ||
|
||
export default function Example() { | ||
const [startDate, setStartDate] = useState<Date | null>(new Date()); | ||
const [endDate, setEndDate] = useState<Date | null>(new Date()); | ||
|
||
return ( | ||
<Flex alignItems="center" height="100%" justifyContent="center" width="100%"> | ||
<DateRange | ||
dateValue={{ startDate, endDate }} | ||
onCancel={() => {}} | ||
onDateChange={(newStartDate, newEndDate) => { | ||
setStartDate(newStartDate.value); | ||
setEndDate(newEndDate.value); | ||
}} | ||
onDateError={{ startDate: () => {}, endDate: () => {} }} | ||
onSubmit={() => {}} | ||
readOnly | ||
/> | ||
</Flex> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters