forked from mui/mui-x
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pickers] Add option to change order of displayed years (mui#11780)
Signed-off-by: Thomas Moon <thomas.moon@teamit.fi> Signed-off-by: Lukas Tyla <llukas.tyla@gmail.com> Co-authored-by: Flavien DELANGLE <flaviendelangle@gmail.com> Co-authored-by: Lukas Tyla <llukas.tyla@gmail.com>
- Loading branch information
1 parent
24fcebc
commit 77cb8bc
Showing
71 changed files
with
423 additions
and
119 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
docs/data/date-pickers/date-calendar/YearsOrderDescendingCalendar.js
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,20 @@ | ||
import * as React from 'react'; | ||
import dayjs from 'dayjs'; | ||
import { DemoContainer, DemoItem } from '@mui/x-date-pickers/internals/demo'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { YearCalendar } from '@mui/x-date-pickers/YearCalendar'; | ||
|
||
const currentYear = dayjs(); | ||
|
||
export default function YearsOrderDescendingCalendar() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DemoContainer components={['YearCalendar']}> | ||
<DemoItem label="Years in descending order"> | ||
<YearCalendar maxDate={currentYear} yearsOrder="desc" /> | ||
</DemoItem> | ||
</DemoContainer> | ||
</LocalizationProvider> | ||
); | ||
} |
20 changes: 20 additions & 0 deletions
20
docs/data/date-pickers/date-calendar/YearsOrderDescendingCalendar.tsx
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,20 @@ | ||
import * as React from 'react'; | ||
import dayjs from 'dayjs'; | ||
import { DemoContainer, DemoItem } from '@mui/x-date-pickers/internals/demo'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { YearCalendar } from '@mui/x-date-pickers/YearCalendar'; | ||
|
||
const currentYear = dayjs(); | ||
|
||
export default function YearsOrderDescendingCalendar() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DemoContainer components={['YearCalendar']}> | ||
<DemoItem label="Years in descending order"> | ||
<YearCalendar maxDate={currentYear} yearsOrder="desc" /> | ||
</DemoItem> | ||
</DemoContainer> | ||
</LocalizationProvider> | ||
); | ||
} |
3 changes: 3 additions & 0 deletions
3
docs/data/date-pickers/date-calendar/YearsOrderDescendingCalendar.tsx.preview
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,3 @@ | ||
<DemoItem label="Years in descending order"> | ||
<YearCalendar maxDate={currentYear} yearsOrder="desc" /> | ||
</DemoItem> |
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
22 changes: 22 additions & 0 deletions
22
docs/data/date-pickers/date-picker/DatePickerYearsOrder.js
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,22 @@ | ||
import * as React from 'react'; | ||
import dayjs from 'dayjs'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { DatePicker } from '@mui/x-date-pickers/DatePicker'; | ||
|
||
const currentYear = dayjs(); | ||
|
||
export default function DatePickerYearsOrder() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DatePicker | ||
label="Years in descending order" | ||
maxDate={currentYear} | ||
openTo="year" | ||
views={['year', 'month']} | ||
yearsOrder="desc" | ||
sx={{ minWidth: 250 }} | ||
/> | ||
</LocalizationProvider> | ||
); | ||
} |
22 changes: 22 additions & 0 deletions
22
docs/data/date-pickers/date-picker/DatePickerYearsOrder.tsx
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,22 @@ | ||
import * as React from 'react'; | ||
import dayjs from 'dayjs'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { DatePicker } from '@mui/x-date-pickers/DatePicker'; | ||
|
||
const currentYear = dayjs(); | ||
|
||
export default function DatePickerYearsOrder() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DatePicker | ||
label="Years in descending order" | ||
maxDate={currentYear} | ||
openTo="year" | ||
views={['year', 'month']} | ||
yearsOrder="desc" | ||
sx={{ minWidth: 250 }} | ||
/> | ||
</LocalizationProvider> | ||
); | ||
} |
8 changes: 8 additions & 0 deletions
8
docs/data/date-pickers/date-picker/DatePickerYearsOrder.tsx.preview
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,8 @@ | ||
<DatePicker | ||
label="Years in descending order" | ||
maxDate={currentYear} | ||
openTo="year" | ||
views={['year', 'month']} | ||
yearsOrder="desc" | ||
sx={{ minWidth: 250 }} | ||
/> |
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
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
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
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
Oops, something went wrong.