import { buttonClasses } from '@mui/material/Button' import { Theme } from '@mui/material/styles' import { Iconify } from '../../../../../components/web/images' const dateList = [ 'DatePicker', 'DateTimePicker', 'StaticDatePicker', 'DesktopDatePicker', 'DesktopDateTimePicker', 'MobileDatePicker', 'MobileDateTimePicker', ] const timeList = ['TimePicker', 'MobileTimePicker', 'StaticTimePicker', 'DesktopTimePicker'] const switchIcon = () => const leftIcon = () => const rightIcon = () => const calendarIcon = () => const clockIcon = () => const desktopTypes = dateList.reduce((result: Record, currentValue) => { // eslint-disable-next-line no-param-reassign result[`Mui${currentValue}`] = { defaultProps: { slots: { openPickerIcon: calendarIcon, leftArrowIcon: leftIcon, rightArrowIcon: rightIcon, switchViewIcon: switchIcon, }, }, } return result }, {}) const timeTypes = timeList.reduce((result: Record, currentValue) => { // eslint-disable-next-line no-param-reassign result[`Mui${currentValue}`] = { defaultProps: { slots: { openPickerIcon: clockIcon, rightArrowIcon: rightIcon, switchViewIcon: switchIcon, }, }, } return result }, {}) export function datePicker(theme: Theme) { return { MuiPickersLayout: { styleOverrides: { root: { '& .MuiPickersLayout-actionBar': { [`& .${buttonClasses.root}:last-of-type`]: { backgroundColor: theme.palette.text.primary, color: theme.palette.mode === 'light' ? theme.palette.common.white : theme.palette.grey[800], }, }, }, }, }, // Date ...desktopTypes, // Time ...timeTypes, } }