"use client" import React from 'react' import dayjs, { Dayjs } from 'dayjs'; import styles from './calendar.module.css' import { CalendarPicker } from '@mui/x-date-pickers/CalendarPicker'; import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; import { createTheme, ThemeProvider } from '@mui/material/styles'; import { styled } from '@mui/material/styles'; import { PickersDay, PickersDayProps } from '@mui/x-date-pickers/PickersDay'; interface CustomPickerDayProps extends PickersDayProps { dayIsBetween: boolean; isFirstDay: boolean; isLastDay: boolean; } const CustomPickersDay = styled(PickersDay, { shouldForwardProp: (prop) => prop !== 'dayIsBetween' && prop !== 'isFirstDay' && prop !== 'isLastDay', })(({ theme, dayIsBetween, isFirstDay, isLastDay }) => ({ ...(dayIsBetween && { borderRadius: 0, backgroundColor: theme.palette.primary.main, color: theme.palette.common.white, '&:hover, &:focus': { backgroundColor: theme.palette.primary.dark, }, }), ...(isFirstDay && { borderTopLeftRadius: '50%', borderBottomLeftRadius: '50%', }), ...(isLastDay && { borderTopRightRadius: '50%', borderBottomRightRadius: '50%', }), })) as React.ComponentType; export default function RecurringCol() { const [value, setValue] = React.useState(dayjs('2021-01-23')); const theme = createTheme({ components: { // Name of the component MuiButtonBase: { defaultProps: { // The props to change the default for. disableRipple: true, // No more ripple, on the whole application 💣! }, }, }, }); const renderWeekPickerDay = ( date: Dayjs, selectedDates: Array, pickersDayProps: PickersDayProps, ) => { if (!value) { return ; } return ( ); }; return (
setValue(newDate)} showDaysOutsideCurrentMonth={true} renderDay={renderWeekPickerDay} />
) }