Skip to content

Commit

Permalink
fix(muiDatePicker): fix migration of mui datePicker from lab to mui-x
Browse files Browse the repository at this point in the history
  • Loading branch information
Clm-Roig committed Apr 19, 2022
1 parent 330fa60 commit f7475b1
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 18 deletions.
84 changes: 75 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"@mui/icons-material": "^5.5.1",
"@mui/lab": "^5.0.0-alpha.78",
"@mui/material": "^5.5.3",
"@mui/x-date-pickers": "^5.0.0-alpha.1",
"@reduxjs/toolkit": "^1.8.1",
"@testing-library/jest-dom": "^5.16.3",
"@testing-library/react": "^12.1.4",
Expand Down
4 changes: 2 additions & 2 deletions src/app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import CloseIcon from '@mui/icons-material/Close';
import { LocalizationProvider } from '@mui/lab';
import DateAdapter from '@mui/lab/AdapterDateFns';
import { Container, IconButton, Paper } from '@mui/material';
import {
StyledEngineProvider,
Expand All @@ -9,6 +7,8 @@ import {
responsiveFontSizes,
styled
} from '@mui/material/styles';
import { LocalizationProvider } from '@mui/x-date-pickers';
import { AdapterDateFns as DateAdapter } from '@mui/x-date-pickers/AdapterDateFns';
import frLocale from 'date-fns/locale/fr';
import { SnackbarKey, SnackbarProvider } from 'notistack';
import { createRef, useMemo, useState } from 'react';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Statistics/MonthPanel/MonthPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DatePicker } from '@mui/lab';
import { Box, TextField } from '@mui/material';
import { DatePicker } from '@mui/x-date-pickers';
import { endOfMonth, startOfMonth } from 'date-fns';
import { FC } from 'react';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Statistics/YearPanel/YearPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DatePicker } from '@mui/lab';
import { Box, TextField } from '@mui/material';
import { DatePicker } from '@mui/x-date-pickers';
import { endOfYear, startOfYear } from 'date-fns';
import { FC } from 'react';

Expand Down
4 changes: 2 additions & 2 deletions src/components/WeekPicker/WeekPicker.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PickersDay, { PickersDayProps } from '@mui/lab/PickersDay';
import StaticDatePicker from '@mui/lab/StaticDatePicker';
import { styled } from '@mui/material/styles';
import { PickersDay, PickersDayProps } from '@mui/x-date-pickers/PickersDay';
import { StaticDatePicker } from '@mui/x-date-pickers/StaticDatePicker';
import { addDays, isBefore, isSameDay, isWithinInterval } from 'date-fns';
import * as React from 'react';
import { FC } from 'react';
Expand Down
4 changes: 2 additions & 2 deletions src/components/WeekPicker/WeekPickerToolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
import { ToolbarComponentProps } from '@mui/lab/internal/pickers/typings/BasePicker';
import { Box, IconButton, Typography } from '@mui/material';
import { BaseToolbarProps } from '@mui/x-date-pickers/internals/models/props/baseToolbarProps';
import { FC } from 'react';

type Props = ToolbarComponentProps<Date | null>;
type Props = BaseToolbarProps<Date | null>;

const WeekPickerToolbar: FC<Props> = (props) => {
const { isMobileKeyboardViewOpen, toggleMobileKeyboardView } = props;
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/TrackerForm/TrackerForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import DatePicker from '@mui/lab/DatePicker';
import { Box, Button, Stack, TextField } from '@mui/material';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
import { FC } from 'react';
import { Controller, useFieldArray, useForm } from 'react-hook-form';
import { v4 } from 'uuid';
Expand Down

0 comments on commit f7475b1

Please sign in to comment.