source: src/theme/overrides/components/date-picker.tsx@ 057453c

main
Last change on this file since 057453c was 5d6f37a, checked in by Naum Shapkarovski <naumshapkarovski@…>, 7 weeks ago

add customer

  • Property mode set to 100644
File size: 2.1 KB
Line 
1import { Theme } from '@mui/material/styles';
2import { buttonClasses } from '@mui/material/Button';
3// components
4import Iconify from 'src/components/iconify';
5
6// ----------------------------------------------------------------------
7
8const dateList = [
9 'DatePicker',
10 'DateTimePicker',
11 'StaticDatePicker',
12 'DesktopDatePicker',
13 'DesktopDateTimePicker',
14 //
15 'MobileDatePicker',
16 'MobileDateTimePicker',
17];
18
19const timeList = ['TimePicker', 'MobileTimePicker', 'StaticTimePicker', 'DesktopTimePicker'];
20
21const switchIcon = () => <Iconify icon="eva:chevron-down-fill" width={24} />;
22
23const leftIcon = () => <Iconify icon="eva:arrow-ios-back-fill" width={24} />;
24
25const rightIcon = () => <Iconify icon="eva:arrow-ios-forward-fill" width={24} />;
26
27const calendarIcon = () => <Iconify icon="solar:calendar-mark-bold-duotone" width={24} />;
28
29const clockIcon = () => <Iconify icon="solar:clock-circle-outline" width={24} />;
30
31const desktopTypes = dateList.reduce((result: Record<string, any>, currentValue) => {
32 result[`Mui${currentValue}`] = {
33 defaultProps: {
34 slots: {
35 openPickerIcon: calendarIcon,
36 leftArrowIcon: leftIcon,
37 rightArrowIcon: rightIcon,
38 switchViewIcon: switchIcon,
39 },
40 },
41 };
42
43 return result;
44}, {});
45
46const timeTypes = timeList.reduce((result: Record<string, any>, currentValue) => {
47 result[`Mui${currentValue}`] = {
48 defaultProps: {
49 slots: {
50 openPickerIcon: clockIcon,
51 rightArrowIcon: rightIcon,
52 switchViewIcon: switchIcon,
53 },
54 },
55 };
56
57 return result;
58}, {});
59
60export function datePicker(theme: Theme) {
61 return {
62 MuiPickersLayout: {
63 styleOverrides: {
64 root: {
65 '& .MuiPickersLayout-actionBar': {
66 [`& .${buttonClasses.root}:last-of-type`]: {
67 backgroundColor: theme.palette.text.primary,
68 color:
69 theme.palette.mode === 'light'
70 ? theme.palette.common.white
71 : theme.palette.grey[800],
72 },
73 },
74 },
75 },
76 },
77
78 // Date
79 ...desktopTypes,
80
81 // Time
82 ...timeTypes,
83 };
84}
Note: See TracBrowser for help on using the repository browser.