头图

In recent work, I need to develop the H5 page on the mobile phone. Instead of using the familiar React + Antd-mobile, React + Taro UI, Vue + uView, I used React + Material-UI to make a new attempt. And just recently React-router/React-router-dom forcibly used hooks mode to iterate a large version @6;

Purpose : tired of antd's mid-stage style, and experience Material's [Dark Mode] and configurable [Palette].
image.pngimage.png

React related version information:

  "react": "^17.0.2",
  "react-dom": "^17.0.2",
  "react-redux": "^7.2.6",
  "react-router": "^6.0.2",
  "react-router-dom": "^6.0.2",

image.png
Material-UI related version information:

  "@emotion/react": "^11.6.0",
  "@emotion/styled": "^11.6.0",
  "@material-ui/core": "^5.0.0-beta.5",
  "@material-ui/styles": "^4.11.4",
  "@mui/icons-material": "^5.1.1",
  "@mui/lab": "^5.0.0-alpha.56",
  "@mui/material": "^5.1.1",

image.png

The components used are:
Typography Button Radio Select Switch TextField Badge List Table Tooltip Alert Dialog Progress Accordion Card Paper Menu Pagination Grid Modal Date Range Picker...

Problems encountered:

1. It is necessary to define the color matching configuration of the preferred theme primary, secondary theme secondary, etc.
2. The components are not localized and need to be localized by themselves [e.g. calendar, etc.]
3. The components need to be re-encapsulated to make it more in line with the Chinese aesthetics

Access Material-UI

Material-UI official website
Note: The component is recommended to be introduced in a single component, example:

    import { Button, Tabs, Modal, Box} from '@material-ui/core/index';
    与
    import Button from '@material-ui/core/Button';
    区别
    上面的引入方式,打包后的包体积是下面的包10倍左右...

Theme configuration

Simply select a few color combinations in Color
: primary dark is 800 color value, main is 600 color value, light is 400 color value; secondary dark is 700 color value, main is 500 color value, light is 200 color value; depending on personal aesthetics, you can use different Match the colors.

themeConfig.js 文件

const theme = {
    pink: {
        palette: {
            primary: {
                light: '#ec407a',
                main: '#d81b60',
                dark: '#ad1457',
                contrastText: '#000',
            },
            secondary: {
                light: '#f48fb1',
                main: '#e91e63',
                dark: '#c2185b',
                contrastText: '#000',
            },
        },
    },
    purple: {
        palette: {
            primary: {
                light: '#ab47bc',
                main: '#8e24aa',
                dark: '#6a1b9a',
            },
            secondary: {
                light: '#ce93d8',
                main: '#9c27b0',
                dark: '#7b1fa2',
            },
        },
    },
    deepPurple: {
        palette: {
            primary: {
                light: '#7e57c2',
                main: '#5e35b1',
                dark: '#4527a0',
                contrastText: '#000',
            },
            secondary: {
                light: '#b39ddb',
                main: '#673ab7',
                dark: '#512da8',
                contrastText: '#000',
            },
        },
    },
    blue: {
        palette: {
            primary: {
                light: '#42a5f5',
                main: '#1e88e5',
                dark: '#1565c0',
                contrastText: '#000',
            },
            secondary: {
                light: '#90caf9',
                main: '#2196f3',
                dark: '#1976d2',
                contrastText: '#000',
            },
        },
    },
    teal: {
        palette: {
            primary: {
                light: '#26a69a',
                main: '#00897b',
                dark: '#00695c',
                contrastText: '#000',
            },
            secondary: {
                light: '#80cbc4',
                main: '#009688',
                dark: '#00796b',
                contrastText: '#000',
            },
        },
    },
    green: {
        palette: {
            primary: {
                light: '#66bb6a',
                main: '#43a047',
                dark: '#2e7d32',
                contrastText: '#000',
            },
            secondary: {
                light: '#a5d6a7',
                main: '#4caf50',
                dark: '#388e3c',
                contrastText: '#000',
            },
        },
    },
    amber: {
        palette: {
            primary: {
                light: '#ffca28',
                main: '#ffb300',
                dark: '#ff8f00',
                contrastText: '#000',
            },
            secondary: {
                light: '#ffe082',
                main: '#ffc107',
                dark: '#ffa000',
                contrastText: '#000',
            },
        },
    },
    blueGrey: {
        palette: {
            primary: {
                light: '#ECEFF1',
                main: '#90A4AE',
                dark: '#455A64',
                contrastText: '#000',
            },
            secondary: {
                light: '#E0E0E0',
                main: '#757575',
                dark: '#424242',
                contrastText: '#000',
            },
        },
    },
    cyan: {
        palette: {
            primary: {
                light: '#E0F7FA',
                main: '#00BCD4',
                dark: '#00838F',
                contrastText: '#000',
            },
            secondary: {
                light: '#E1F5FE',
                main: '#039BE5',
                dark: '#01579B',
                contrastText: '#000',
            },
        },
    },
};
export default theme;

image.png

Global basic CSS style configuration

import themePalette from './themePaletteMode';
import { colorToRgba } from './../../utils/colorToRgba';
const applicationTheme = (color, mode, direction) => ({
    direction,
    palette: {
        type: mode,
        primary: themePalette(color, mode).palette.primary,
        secondary: themePalette(color, mode).palette.secondary,
        action: {
            hover: mode === 'dark' ? 'rgba(80,80,80, 0.9)' : 'rgba(80,80,80, 0.05)',
            hoverOpacity: 0.05,
        },
    },
    typography: {
        useNextVariants: true,
        fontFamily: ['Open Sans', 'sans-serif'].join(','),
        title: {
            fontWeight: 600,
        },
        body2: {
            fontWeight: 500,
        },
        fontWeightMedium: 600,
    },
    shade: {
        light: '0 10px 15px -5px rgba(62, 57, 107, .07)',
    },
    glow: {
        light: `0 2px 20px -5px ${themePalette(color, mode).palette.primary.main}`,
        medium: `0 2px 40px -5px ${themePalette(color, mode).palette.primary.main}`,
        dark: `0 2px 40px 0px ${themePalette(color, mode).palette.primary.main}`,
    },
    rounded: {
        small: '8px',
        medium: '12px',
        big: '20px',
    },
    shadows:
        mode === 'dark'
            ? [
                  'none',
                  `0px 1px 3px 0px rgba(100,100,100, 0.6),0px 1px 1px 0px rgba(100,100,100, 0.4),0px 2px 1px -1px rgba(100,100,100, 0.2)`,
                  '0px 1px 5px 0px rgba(100,100,100, 0.6),0px 2px 2px 0px rgba(100,100,100, 0.4),0px 3px 1px -2px rgba(100,100,100, 0.2)',
                  '0px 1px 8px 0px rgba(100,100,100, 0.6),0px 3px 4px 0px rgba(100,100,100, 0.4),0px 3px 3px -2px rgba(100,100,100, 0.2)',
                  '0px 2px 4px -1px rgba(100,100,100, 0.6),0px 4px 5px 0px rgba(100,100,100, 0.4),0px 1px 10px 0px rgba(100,100,100, 0.2)',
                  '0px 3px 5px -1px rgba(100,100,100, 0.6),0px 5px 8px 0px rgba(100,100,100, 0.4),0px 1px 14px 0px rgba(100,100,100, 0.2)',
                  '0px 3px 5px -1px rgba(100,100,100, 0.6),0px 6px 10px 0px rgba(100,100,100, 0.4),0px 1px 18px 0px rgba(100,100,100, 0.2)',
                  '0px 4px 5px -2px rgba(100,100,100, 0.6),0px 7px 10px 1px rgba(100,100,100, 0.4),0px 2px 16px 1px rgba(100,100,100, 0.2)',
                  '0px 5px 5px -3px rgba(100,100,100, 0.6),0px 8px 10px 1px rgba(100,100,100, 0.4),0px 3px 14px 2px rgba(100,100,100, 0.2)',
                  '0px 5px 6px -3px rgba(100,100,100, 0.6),0px 9px 12px 1px rgba(100,100,100, 0.4),0px 3px 16px 2px rgba(100,100,100, 0.2)',
                  '0px 6px 6px -3px rgba(100,100,100, 0.6),0px 10px 14px 1px rgba(100,100,100, 0.4),0px 4px 18px 3px rgba(100,100,100, 0.2)',
                  '0px 6px 7px -4px rgba(100,100,100, 0.6),0px 11px 15px 1px rgba(100,100,100, 0.4),0px 4px 20px 3px rgba(100,100,100, 0.2)',
                  '0px 7px 8px -4px rgba(100,100,100, 0.6),0px 12px 17px 2px rgba(100,100,100, 0.4),0px 5px 22px 4px rgba(100,100,100, 0.2)',
                  '0px 7px 8px -4px rgba(100,100,100, 0.6),0px 13px 19px 2px rgba(100,100,100, 0.4),0px 5px 24px 4px rgba(100,100,100, 0.2)',
                  '0px 7px 9px -4px rgba(100,100,100, 0.6),0px 14px 21px 2px rgba(100,100,100, 0.4),0px 5px 26px 4px rgba(100,100,100, 0.2)',
                  '0px 8px 9px -5px rgba(100,100,100, 0.6),0px 15px 22px 2px rgba(100,100,100, 0.4),0px 6px 28px 5px rgba(100,100,100, 0.2)',
                  '0px 8px 10px -5px rgba(100,100,100, 0.6),0px 16px 24px 2px rgba(100,100,100, 0.4),0px 6px 30px 5px rgba(100,100,100, 0.2)',
                  '0px 8px 11px -5px rgba(100,100,100, 0.6),0px 17px 26px 2px rgba(100,100,100, 0.4),0px 6px 32px 5px rgba(100,100,100, 0.2)',
                  '0px 9px 11px -5px rgba(100,100,100, 0.6),0px 18px 28px 2px rgba(100,100,100, 0.4),0px 7px 34px 6px rgba(100,100,100, 0.2)',
                  '0px 9px 12px -6px rgba(100,100,100, 0.6),0px 19px 29px 2px rgba(100,100,100, 0.4),0px 7px 36px 6px rgba(100,100,100, 0.2)',
                  '0px 10px 13px -6px rgba(100,100,100, 0.6),0px 20px 31px 3px rgba(100,100,100, 0.4),0px 8px 38px 7px rgba(100,100,100, 0.2)',
                  '0px 10px 13px -6px rgba(100,100,100, 0.6),0px 21px 33px 3px rgba(100,100,100, 0.4),0px 8px 40px 7px rgba(100,100,100, 0.2)',
                  '0px 10px 14px -6px rgba(100,100,100, 0.6),0px 22px 35px 3px rgba(100,100,100, 0.4),0px 8px 42px 7px rgba(100,100,100, 0.2)',
                  '0px 11px 14px -7px rgba(100,100,100, 0.6),0px 23px 36px 3px rgba(100,100,100, 0.4),0px 9px 44px 8px rgba(100,100,100, 0.2)',
                  '0px 11px 15px -7px rgba(100,100,100, 0.6),0px 24px 38px 3px rgba(100,100,100 0.14),0px 9px 46px 8px rgba(100,100,100, 0.2)',
              ]
            : [
                  'none',
                  `0px 1px 3px 0px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 1px 1px 0px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 2px 1px -1px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 1px 5px 0px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 2px 2px 0px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 3px 1px -2px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 1px 8px 0px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 3px 4px 0px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 3px 3px -2px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 2px 4px -1px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 4px 5px 0px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 1px 10px 0px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 3px 5px -1px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 5px 8px 0px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 1px 14px 0px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 3px 5px -1px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 6px 10px 0px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 1px 18px 0px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 4px 5px -2px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 7px 10px 1px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 2px 16px 1px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 5px 5px -3px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 8px 10px 1px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 3px 14px 2px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 5px 6px -3px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 9px 12px 1px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 3px 16px 2px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 6px 6px -3px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 10px 14px 1px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 4px 18px 3px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 6px 7px -4px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 11px 15px 1px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 4px 20px 3px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 7px 8px -4px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 12px 17px 2px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 5px 22px 4px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 7px 8px -4px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 13px 19px 2px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 5px 24px 4px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 7px 9px -4px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 14px 21px 2px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 5px 26px 4px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 8px 9px -5px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 15px 22px 2px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 6px 28px 5px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 8px 10px -5px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 16px 24px 2px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 6px 30px 5px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 8px 11px -5px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 17px 26px 2px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 6px 32px 5px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 9px 11px -5px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 18px 28px 2px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 7px 34px 6px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 9px 12px -6px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 19px 29px 2px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 7px 36px 6px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 10px 13px -6px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 20px 31px 3px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 8px 38px 7px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 10px 13px -6px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 21px 33px 3px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 8px 40px 7px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 10px 14px -6px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 22px 35px 3px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 8px 42px 7px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 11px 14px -7px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 23px 36px 3px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 9px 44px 8px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
                  `0px 11px 15px -7px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.2,
                  )},0px 24px 38px 3px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.14,
                  )},0px 9px 46px 8px ${colorToRgba(
                      themePalette(color, mode).palette.primary.light,
                      0.12,
                  )}`,
              ],
    components: {
        MuiButton: {
            contained: {
                boxShadow: 'none',
            },
            root: {
                borderRadius: 20,
                fontWeight: 600,
            },
            sizeSmall: {
                padding: '7px 12px',
            },
        },
    },
});

export default applicationTheme;

Note: The complete api configuration items, please refer to the official website

Configure theme day/night mode

    import { useTheme } from '@mui/material/styles';
    const theme = useTheme();
    const { children } = props;
    ...
    <Box
      sx={{
          minHeight: '100vh',
          bgcolor: theme.palette.mode === 'dark' ? '#000' : '#fff',
          color: theme.palette.mode === 'dark' ? '#fff' : '#000',
      }}>
      {children}
    </Box>

Note: The theme configuration api contains background configuration items, you can use custom configuration

Configure palette

ThemePalette(color, mode).palette has been merged in the applicationTheme function. Here you only need to customize the theme color in the themePalette function.

  import themeConfig from './themeConfig'

  const themePalette = (color, mode) => {
    return themeConfig[color];
  };
  export default themePalette;

Note: The themeConfig file has been pasted above, here I did not use the mode parameter, you can configure different dark/light theme colors according to the actual situation of the project. For example: subdivide dark-palette / light-palette under pink;

Sinicization of components

Take Date Range Picke as an example:
Original time interval selector
image.pngimage.png

After Sinicization:

image.pngimage.png

Some APIs are provided on the official website
image.pngimage.png
Note: One of the points to note: 1? and 2? The two departments searched through the api documentation and api source code, but did not find the corresponding api. You can only modify the source code of the corresponding component, and locate it according to the component source code.

 1? 的位置存在于 组件@mui/lab/CalendarPicker/PickersCalendarHeader.js 中
    修改如下:
    transKey: month.getMonth() + 1, // 这里将 utils.format(month, 'month') 修改为 month.getMonth() + 1
    children: month.getMonth() + 1 // 这里将 utils.format(month, 'month') 修改为 month.getMonth() + 1
 2? 的位置存在于 组件@mui/lab/CalendarPicker/PickersCalendar.js中
     修改如下:
    children: ['日','一','二','三','四','五','六'].map((day, i) => /*#__PURE__*/_jsx(PickersCalendarWeekDayLabel, {
    // 这里将 这里将  utils.getWeekdays() 修改为 ['日','一','二','三','四','五','六']

    使用 patch-package 将 修改后的打包成 patches包。

Also note: after setting inputFormat="yyyy/MM/dd", the console will pop up a warning

The mask "__/__/____" you passed is not valid for the format used yyyy/MM/dd. Falling down to uncontrolled not-masked input.

Here are the configuration items related to the mask according to the source code. There is no good solution for the time being.
image.png

Secondary packaging of components

Among them, the more commonly used ones are Input Select Modal, etc., here is a brief introduction

1. Input component TextField InputBase

image.png
image.png

    <Paper sx={{ p: '2px 4px', display: 'flex', alignItems: 'center', width: '100%' }}>
        <InputBase
            sx={{ ml: 1, flex: 1 }}
            placeholder="请输入"
            inputProps={{ 'aria-label': '请输入' }}
            onKeyUp={(e) => {
               ...
            }}
        />
        <IconButton
            type="search"
            onClick={() => {
                ...
            }}
            sx={{ p: 1 }}
            aria-label="search">
            <SearchIcon />
        </IconButton>
    </Paper>
2. Select component TextField
image.png
  <TextField
    id="search_select"
    select
    sx={{ width: 130, bgcolor: 'transparent' }}
    value={currency}
    onChange={(e) => ...}>
    {selectArr.map((option) => (
        <MenuItem className="search_item" key={option.value} value={option.value}>
            <span style={{ fontSize: 12 }}>{option.label}</span>
        </MenuItem>
    ))}
  </TextField>

Note: The more attention here is the adjustment of the style

    #search_select {
        min-height: 30px !important;
        padding: 0 0 0 10px !important;
        line-height: 30px !important;
    }
    .search_item {
        min-height: 30px;
        line-height: 30px;
        padding: 0 0 0 10px;
    }

Modal components

   const style = {
        position: 'absolute',
        top: '50%',
        left: '50%',
        borderRadius: 2,
        transform: 'translate(-50%, -50%)',
        width: '60vw',
        bgcolor: 'background.paper',
        pt: 2,
        pb: 2,
    };
    <Modal
        open={open}
        onClose={handleClose}
        hideBackdrop
        aria-labelledby="modal-modal-title"
        aria-describedby="modal-modal-description">
        <Box sx={style}>
            <Typography
                sx={{ fontSize: 16, mb: 2, pl: 2, pb: 0.5 }}
                variant="h6"
                gutterBottom
                component="div">
                {title}
            </Typography>
            <Box
                sx={{
                    display: 'flex',
                    alignItem: 'center',
                    justifyContent: 'center',
                    flexWrap: 'wrap',
                }}>
                ...
            </Box>
        </Box>
    </Modal>

Summarize

Material-UI is still relatively playable, and there are many demos on the official website. However, after the version is upgraded to 5.X, many APIs have been abandoned, and the matching needs to be studied by yourself. Generally speaking, the Material style is still good. In the follow-up process, we will summarize and update the document. . .


小蜗牛
4.4k 声望16.1k 粉丝

不高不帅,时常犯二, 在逗比的道路上越走越远。。。