Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modularize MUI imports and bump up MUI version #1135

Merged
merged 3 commits into from
Nov 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ Read more at [End-2-End Testing](https://github.com/podkrepi-bg/frontend/blob/ma
## Contributors ✨

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

[![All Contributors](https://img.shields.io/badge/all_contributors-57-orange.svg?style=flat-square)](#contributors-)

<!-- ALL-CONTRIBUTORS-BADGE:END -->

Please check [contributors guide](https://github.com/podkrepi-bg/frontend/blob/master/CONTRIBUTING.md) for:
Expand Down
10 changes: 10 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ const moduleExports = {
},
]
},
experimental: {
modularizeImports: {
'@mui/material': {
transform: '@mui/material/{{member}}',
},
'@mui/icons-material/?(((\\w*)?/?)*)': {
transform: '@mui/icons-material/{{ matches.[1] }}/{{member}}',
},
},
},
}

const SentryWebpackPluginOptions = {
Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@
"@emotion/react": "^11.8.1",
"@emotion/server": "^11.4.0",
"@emotion/styled": "^11.8.1",
"@mui/icons-material": "^5.4.2",
"@mui/icons-material": "^5.10.14",
"@mui/lab": "^5.0.0-alpha.69",
"@mui/material": "^5.4.2",
"@mui/styles": "^5.4.2",
"@mui/system": "^5.2.8",
"@mui/x-data-grid": "^5.5.1",
"@mui/x-date-pickers": "^5.0.0-alpha.1",
"@mui/material": "^5.10.14",
"@mui/styles": "^5.10.14",
"@mui/x-data-grid": "^5.17.2",
"@mui/x-date-pickers": "^5.0.8",
"@next/bundle-analyzer": "^12.1.0",
"@paypal/react-paypal-js": "^7.8.1",
"@react-pdf/renderer": "^3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/components/about/AboutPage.styled.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Image from 'next/image'

import { styled } from '@mui/system'
import { styled } from '@mui/material/styles'
import { Grid, Link, Typography } from '@mui/material'

import theme from 'common/theme'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { styled } from '@mui/system'
import { styled } from '@mui/material/styles'
import { Typography } from '@mui/material'

import theme from 'common/theme'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { styled } from '@mui/system'
import { styled } from '@mui/material/styles'
import { Grid } from '@mui/material'

import theme from 'common/theme'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { styled } from '@mui/system'
import { styled } from '@mui/material/styles'
import { Grid } from '@mui/material'

import theme from 'common/theme'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { styled } from '@mui/system'
import { styled } from '@mui/material/styles'
import { Grid, Link, Typography } from '@mui/material'

import theme from 'common/theme'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { styled } from '@mui/system'
import { styled } from '@mui/material/styles'
import { CardContent, CardHeader, Typography } from '@mui/material'

import theme from 'common/theme'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { styled } from '@mui/system'
import { styled } from '@mui/material/styles'
import { Grid, Typography } from '@mui/material'

import theme from 'common/theme'
Expand Down
3 changes: 1 addition & 2 deletions src/components/auth/profile/DonationAgreementTab.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import ProfileTab from './ProfileTab'
import { ProfileTabs } from './tabs'
import { styled } from '@mui/material/styles'
import { Box } from '@mui/system'
import { Typography } from '@mui/material'
import { Typography, Box } from '@mui/material'

const PREFIX = 'CertificatesTab'

Expand Down
2 changes: 1 addition & 1 deletion src/components/auth/profile/DonationTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
TableRow,
Button,
Link,
Box,
} from '@mui/material'
import { Box } from '@mui/system'
import styled from '@emotion/styled'
import React, { useMemo } from 'react'
import { bg, enUS } from 'date-fns/locale'
Expand Down
11 changes: 2 additions & 9 deletions src/components/campaigns/InlineDonation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,8 @@ import { baseUrl, routes } from 'common/routes'
import { moneyPublic } from 'common/util/money'
import CampaignProgress from './CampaignProgress'
import DonorsAndDonations from './DonorsAndDonations'
import {
Button,
CircularProgress,
Grid,
IconButton,
lighten,
Menu,
Typography,
} from '@mui/material'
import { Button, CircularProgress, Grid, IconButton, Menu, Typography } from '@mui/material'
import { lighten } from '@mui/material/styles'
import { AddLinkOutlined, Favorite } from '@mui/icons-material'
import ShareIcon from '@mui/icons-material/Share'
import { useCampaignDonationHistory } from 'common/hooks/campaigns'
Expand Down
3 changes: 1 addition & 2 deletions src/components/common/GridCellExpand.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Paper, Popper, Typography } from '@mui/material'
import { Box } from '@mui/system'
import { Paper, Popper, Typography, Box } from '@mui/material'
import * as React from 'react'

interface GridCellExpandProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/form/CircleCheckboxField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
FormControlLabelProps,
FormHelperText,
Icon,
lighten,
Typography,
} from '@mui/material'
import { lighten } from '@mui/material/styles'
import { TranslatableField, translateError } from 'common/form/validation'
import React from 'react'
import CheckIcon from '@mui/icons-material/Check'
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/form/RadioButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Check } from '@mui/icons-material'
import { styled } from '@mui/material/styles'
import { FormControlLabel, Radio, lighten, Typography, RadioProps } from '@mui/material'
import { styled, lighten } from '@mui/material/styles'
import { FormControlLabel, Radio, Typography, RadioProps } from '@mui/material'
import theme from 'common/theme'
import React from 'react'

Expand Down
4 changes: 2 additions & 2 deletions src/components/donations/grid/RenderEditPersonCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { AxiosError, AxiosResponse } from 'axios'
import { useMutation } from 'react-query'
import { useTranslation } from 'next-i18next'
import { GridRenderEditCellParams, GridCellModes } from '@mui/x-data-grid'
import { Autocomplete, createFilterOptions, TextField, Tooltip, Box } from '@mui/material'
import { TextField, Tooltip, Box } from '@mui/material'
import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete'
import { Save } from '@mui/icons-material'

import { PersonResponse } from 'gql/person'
import { DonationResponse, UserDonationInput } from 'gql/donations'
import { useEditDonation } from 'service/donation'
Expand Down
2 changes: 1 addition & 1 deletion src/components/index/IndexPage.styled.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Typography } from '@mui/material'
import { styled } from '@mui/system'
import { styled } from '@mui/material/styles'

import theme from 'common/theme'
import LinkButton from 'components/common/LinkButton'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Typography } from '@mui/material'
import { styled } from '@mui/system'
import { styled } from '@mui/material/styles'

import theme from 'common/theme'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Grid } from '@mui/material'
import { styled } from '@mui/system'
import { styled } from '@mui/material/styles'

import theme from 'common/theme'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { styled } from '@mui/system'
import { styled } from '@mui/material/styles'

import theme from 'common/theme'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { styled } from '@mui/system'
import { styled } from '@mui/material/styles'

import LinkButton from 'components/common/LinkButton'
import theme from 'common/theme'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Grid } from '@mui/material'
import { styled } from '@mui/system'
import { styled } from '@mui/material/styles'

import LinkButton from 'components/common/LinkButton'
import theme from 'common/theme'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { styled } from '@mui/system'
import { styled } from '@mui/material/styles'

import theme from 'common/theme'

Expand Down
2 changes: 1 addition & 1 deletion src/components/irregularity/steps/Contacts.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect } from 'react'
import { useTranslation } from 'next-i18next'

import { styled } from '@mui/system'
import { styled } from '@mui/material/styles'
import { Grid, Typography } from '@mui/material'

import { routes } from 'common/routes'
Expand Down
2 changes: 1 addition & 1 deletion src/components/irregularity/steps/Info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect } from 'react'
import { Field } from 'formik'
import { useTranslation } from 'next-i18next'

import { styled } from '@mui/system'
import { styled } from '@mui/material/styles'
import { FormControl, Grid, Typography } from '@mui/material'

import FileUpload from 'components/file-upload/FileUpload'
Expand Down
5 changes: 3 additions & 2 deletions src/components/layout/Footer/Footer.styled.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Container, Grid, lighten, Typography } from '@mui/material'
import { styled } from '@mui/system'
import { Container, Grid, Typography } from '@mui/material'
import { lighten } from '@mui/material/styles'
import { styled } from '@mui/material/styles'

import theme from 'common/theme'

Expand Down
4 changes: 2 additions & 2 deletions src/components/layout/nav/AdminMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useState } from 'react'
import { styled } from '@mui/material/styles'
import { styled, lighten } from '@mui/material/styles'
import { useSession } from 'next-auth/react'
import { useTranslation } from 'next-i18next'
import { Avatar, Grid, IconButton, lighten, Menu, Typography } from '@mui/material'
import { Avatar, Grid, IconButton, Menu, Typography } from '@mui/material'

import theme from 'common/theme'
import { routes } from 'common/routes'
Expand Down
4 changes: 2 additions & 2 deletions src/components/layout/nav/DonationMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { styled } from '@mui/material/styles'
import { styled, lighten } from '@mui/material/styles'
import { useRouter } from 'next/router'
import { Typography, lighten } from '@mui/material'
import { Typography } from '@mui/material'
import { useTranslation } from 'next-i18next'

import { routes } from 'common/routes'
Expand Down
4 changes: 2 additions & 2 deletions src/components/layout/nav/PrivateMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useState } from 'react'
import { styled } from '@mui/material/styles'
import { styled, lighten } from '@mui/material/styles'
import { useSession } from 'next-auth/react'
import { useTranslation } from 'next-i18next'
import { Avatar, Grid, IconButton, lighten, Menu, Typography } from '@mui/material'
import { Avatar, Grid, IconButton, Menu, Typography } from '@mui/material'

import theme from 'common/theme'
import { routes } from 'common/routes'
Expand Down
3 changes: 2 additions & 1 deletion src/components/layout/nav/ProjectMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react'
import { styled } from '@mui/material/styles'
import { useRouter } from 'next/router'
import { Typography, lighten } from '@mui/material'
import { Typography } from '@mui/material'
import { lighten } from '@mui/material/styles'
import { useTranslation } from 'next-i18next'

import { routes, staticUrls } from 'common/routes'
Expand Down
4 changes: 2 additions & 2 deletions src/components/layout/nav/PublicMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useState } from 'react'
import { styled } from '@mui/material/styles'
import { styled, lighten } from '@mui/material/styles'
import { useTranslation } from 'next-i18next'
import PersonIcon from '@mui/icons-material/Person'
import { Grid, Button, Menu, Typography, lighten } from '@mui/material'
import { Grid, Button, Menu, Typography } from '@mui/material'
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown'
import ArrowDropUpIcon from '@mui/icons-material/ArrowDropUp'

Expand Down
2 changes: 1 addition & 1 deletion src/components/person/PersonDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
Alert,
AlertTitle,
IconButton,
Box,
} from '@mui/material'
import { Box } from '@mui/system'
import { FormikConfig } from 'formik'
import React, { useState } from 'react'
import { useTranslation } from 'react-i18next'
Expand Down
3 changes: 2 additions & 1 deletion src/components/support-form/helpers/HeaderTypography.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { lighten, Typography } from '@mui/material'
import { Typography } from '@mui/material'
import { lighten } from '@mui/material/styles'
import { ReactNode } from 'react'

export default function HeaderTypography({ children }: { children: ReactNode }) {
Expand Down
3 changes: 2 additions & 1 deletion src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { EmotionCache } from '@emotion/cache'
import { CacheProvider } from '@emotion/react'
import React, { useEffect, useState } from 'react'
import { appWithTranslation, useTranslation } from 'next-i18next'
import { CssBaseline, ThemeProvider, Theme } from '@mui/material'
import { ThemeProvider, Theme } from '@mui/material/styles'
import { CssBaseline } from '@mui/material'
import { Hydrate, QueryClient, QueryClientProvider } from 'react-query'

import theme from 'common/theme'
Expand Down
Loading