Skip to content

Commit

Permalink
[core] Remove v4 conditional code (#2575)
Browse files Browse the repository at this point in the history
* [core] Remove v4 conditional code
  • Loading branch information
flaviendelangle authored Sep 30, 2021
1 parent 205646a commit f7fbc7d
Show file tree
Hide file tree
Showing 48 changed files with 140 additions and 301 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { makeStyles } from '@mui/styles';
import { createTheme, Theme } from '@mui/material/styles';
import { createTheme } from '@mui/material/styles';
import Button from '@mui/material/Button';
import {
GridColumnMenu,
Expand All @@ -15,7 +15,7 @@ import StarOutlineIcon from '@mui/icons-material/StarOutline';

const defaultTheme = createTheme();
const useStyles = makeStyles(
(theme: Theme) => ({
(theme) => ({
primary: {
background: theme.palette.primary.main,
color: theme.palette.primary.contrastText,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as React from 'react';
import { GridOverlay, DataGrid } from '@mui/x-data-grid';
import { useDemoData } from '@mui/x-data-grid-generator';
import { createTheme, Theme } from '@mui/material/styles';
import { createTheme } from '@mui/material/styles';
import { createStyles, makeStyles } from '@mui/styles';

const defaultTheme = createTheme();
const useStyles = makeStyles(
(theme: Theme) =>
(theme) =>
createStyles({
root: {
flexDirection: 'column',
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/data-grid/demo/FullFeaturedDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DataGridPro, GridToolbar } from '@mui/x-data-grid-pro';
import { useDemoData } from '@mui/x-data-grid-generator';
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
import { makeStyles } from '@mui/styles';
import { createTheme, Theme } from '@mui/material/styles';
import { createTheme } from '@mui/material/styles';
import FormControl from '@mui/material/FormControl';
import FormGroup from '@mui/material/FormGroup';
import Button from '@mui/material/Button';
Expand Down Expand Up @@ -140,7 +140,7 @@ const useStylesAntDesign = makeStyles(
);

const useStyles = makeStyles(
(theme: Theme) => ({
(theme) => ({
root: {
display: 'flex',
flexDirection: 'column',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@ import { makeStyles } from '@mui/styles';
import { DataGrid } from '@mui/x-data-grid';
import { randomPrice } from '@mui/x-data-grid-generator';

function getThemePaletteMode(palette) {
return palette.type || palette.mode;
}

const defaultTheme = createTheme();

const useStyles = makeStyles(
(theme) => {
const isDark = getThemePaletteMode(theme.palette) === 'dark';
const isDark = theme.palette.mode === 'dark';

return {
root: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { createTheme, Theme } from '@mui/material/styles';
import { createTheme } from '@mui/material/styles';
import { makeStyles } from '@mui/styles';
import {
DataGrid,
Expand All @@ -9,15 +9,11 @@ import {
} from '@mui/x-data-grid';
import { randomPrice } from '@mui/x-data-grid-generator';

function getThemePaletteMode(palette: any): string {
return palette.type || palette.mode;
}

const defaultTheme = createTheme();

const useStyles = makeStyles(
(theme: Theme) => {
const isDark = getThemePaletteMode(theme.palette) === 'dark';
(theme) => {
const isDark = theme.palette.mode === 'dark';

return {
root: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import {
randomUpdatedDate,
randomId,
} from '@mui/x-data-grid-generator';
import { createTheme, Theme } from '@mui/material/styles';
import { createTheme } from '@mui/material/styles';
import { makeStyles } from '@mui/styles';

const defaultTheme = createTheme();

const useStyles = makeStyles(
(theme: Theme) => ({
(theme) => ({
actions: {
color: theme.palette.text.secondary,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@ import {
randomUpdatedDate,
} from '@mui/x-data-grid-generator';

// TODO v5: remove
function getThemePaletteMode(palette) {
return palette.type || palette.mode;
}

const defaultTheme = createTheme();
const useStyles = makeStyles(
(theme) => {
const backgroundColor =
getThemePaletteMode(theme.palette) === 'dark' ? '#376331' : 'rgb(217 243 190)';
theme.palette.mode === 'dark' ? '#376331' : 'rgb(217 243 190)';
return {
root: {
'& .MuiDataGrid-cell--editable': {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { createTheme, Theme } from '@mui/material/styles';
import { createTheme } from '@mui/material/styles';
import { makeStyles } from '@mui/styles';
import { DataGrid, GridColumns, GridRowsProp } from '@mui/x-data-grid';
import {
Expand All @@ -8,16 +8,11 @@ import {
randomUpdatedDate,
} from '@mui/x-data-grid-generator';

// TODO v5: remove
function getThemePaletteMode(palette: any): string {
return palette.type || palette.mode;
}

const defaultTheme = createTheme();
const useStyles = makeStyles(
(theme: Theme) => {
(theme) => {
const backgroundColor =
getThemePaletteMode(theme.palette) === 'dark' ? '#376331' : 'rgb(217 243 190)';
theme.palette.mode === 'dark' ? '#376331' : 'rgb(217 243 190)';
return {
root: {
'& .MuiDataGrid-cell--editable': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import {
randomTraderName,
randomUpdatedDate,
} from '@mui/x-data-grid-generator';
import { createTheme, Theme } from '@mui/material/styles';
import { createTheme } from '@mui/material/styles';
import { makeStyles } from '@mui/styles';

const defaultTheme = createTheme();
const useStyles = makeStyles(
(theme: Theme) => ({
(theme) => ({
root: {
justifyContent: 'center',
display: 'flex',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@ import {
randomUpdatedDate,
} from '@mui/x-data-grid-generator';

// TODO v5: remove
function getThemePaletteMode(palette) {
return palette.type || palette.mode;
}

const defaultTheme = createTheme();
const useStyles = makeStyles(
(theme) => {
const isDark = getThemePaletteMode(theme.palette) === 'dark';
const isDark = theme.palette.mode === 'dark';

return {
root: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { createTheme, Theme } from '@mui/material/styles';
import { createTheme } from '@mui/material/styles';
import { makeStyles } from '@mui/styles';
import {
DataGrid,
Expand All @@ -14,15 +14,10 @@ import {
randomUpdatedDate,
} from '@mui/x-data-grid-generator';

// TODO v5: remove
function getThemePaletteMode(palette: any): string {
return palette.type || palette.mode;
}

const defaultTheme = createTheme();
const useStyles = makeStyles(
(theme: Theme) => {
const isDark = getThemePaletteMode(theme.palette) === 'dark';
(theme) => {
const isDark = theme.palette.mode === 'dark';

return {
root: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,10 @@ import { createTheme } from '@mui/material/styles';
import { makeStyles } from '@mui/styles';
import { useGridApiRef, DataGridPro } from '@mui/x-data-grid-pro';

// TODO v5: remove
function getThemePaletteMode(palette) {
return palette.type || palette.mode;
}

const defaultTheme = createTheme();
const useStyles = makeStyles(
(theme) => {
const isDark = getThemePaletteMode(theme.palette) === 'dark';
const isDark = theme.palette.mode === 'dark';

return {
root: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { createTheme, Theme } from '@mui/material/styles';
import { createTheme } from '@mui/material/styles';
import { makeStyles } from '@mui/styles';
import {
GridColumns,
Expand All @@ -9,15 +9,10 @@ import {
DataGridPro,
} from '@mui/x-data-grid-pro';

// TODO v5: remove
function getThemePaletteMode(palette: any): string {
return palette.type || palette.mode;
}

const defaultTheme = createTheme();
const useStyles = makeStyles(
(theme: Theme) => {
const isDark = getThemePaletteMode(theme.palette) === 'dark';
(theme) => {
const isDark = theme.palette.mode === 'dark';

return {
root: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { useDemoData } from '@mui/x-data-grid-generator';
import ClearIcon from '@mui/icons-material/Clear';
import SearchIcon from '@mui/icons-material/Search';
import { createTheme, Theme } from '@mui/material/styles';
import { createTheme } from '@mui/material/styles';
import { createStyles, makeStyles } from '@mui/styles';

function escapeRegExp(value: string): string {
Expand All @@ -18,7 +18,7 @@ function escapeRegExp(value: string): string {

const defaultTheme = createTheme();
const useStyles = makeStyles(
(theme: Theme) =>
(theme) =>
createStyles({
root: {
padding: theme.spacing(0.5, 0.5, 0),
Expand Down
6 changes: 3 additions & 3 deletions docs/src/pages/components/data-grid/style/AntDesignGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as React from 'react';
import { DataGrid, useGridSlotComponentProps } from '@mui/x-data-grid';
import { useDemoData } from '@mui/x-data-grid-generator';
import { createTheme, Theme } from '@mui/material/styles';
import { createTheme } from '@mui/material/styles';
import { createStyles, makeStyles } from '@mui/styles';
import Pagination from '@mui/material/Pagination';
import PaginationItem from '@mui/material/PaginationItem';

function customCheckbox(theme: Theme) {
function customCheckbox(theme) {
return {
'& .MuiCheckbox-root svg': {
width: 16,
Expand Down Expand Up @@ -52,7 +52,7 @@ function customCheckbox(theme: Theme) {

const defaultTheme = createTheme();
const useStyles = makeStyles(
(theme: Theme) =>
(theme) =>
createStyles({
root: {
border: 0,
Expand Down
13 changes: 2 additions & 11 deletions docs/src/pages/components/data-grid/style/StylingRowsGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,14 @@ import { useDemoData } from '@mui/x-data-grid-generator';
import { createTheme, darken, lighten } from '@mui/material/styles';
import { makeStyles } from '@mui/styles';

// TODO v5: remove
function getThemePaletteMode(palette) {
return palette.type || palette.mode;
}

const defaultTheme = createTheme();
const useStyles = makeStyles(
(theme) => {
const getBackgroundColor = (color) =>
getThemePaletteMode(theme.palette) === 'dark'
? darken(color, 0.6)
: lighten(color, 0.6);
theme.palette.mode === 'dark' ? darken(color, 0.6) : lighten(color, 0.6);

const getHoverBackgroundColor = (color) =>
getThemePaletteMode(theme.palette) === 'dark'
? darken(color, 0.5)
: lighten(color, 0.5);
theme.palette.mode === 'dark' ? darken(color, 0.5) : lighten(color, 0.5);

return {
root: {
Expand Down
17 changes: 4 additions & 13 deletions docs/src/pages/components/data-grid/style/StylingRowsGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
import * as React from 'react';
import { DataGrid } from '@mui/x-data-grid';
import { useDemoData } from '@mui/x-data-grid-generator';
import { createTheme, darken, lighten, Theme } from '@mui/material/styles';
import { createTheme, darken, lighten } from '@mui/material/styles';
import { makeStyles } from '@mui/styles';

// TODO v5: remove
function getThemePaletteMode(palette: any): string {
return palette.type || palette.mode;
}

const defaultTheme = createTheme();
const useStyles = makeStyles(
(theme: Theme) => {
(theme) => {
const getBackgroundColor = (color) =>
getThemePaletteMode(theme.palette) === 'dark'
? darken(color, 0.6)
: lighten(color, 0.6);
theme.palette.mode === 'dark' ? darken(color, 0.6) : lighten(color, 0.6);

const getHoverBackgroundColor = (color) =>
getThemePaletteMode(theme.palette) === 'dark'
? darken(color, 0.5)
: lighten(color, 0.5);
theme.palette.mode === 'dark' ? darken(color, 0.5) : lighten(color, 0.5);

return {
root: {
Expand Down
Loading

0 comments on commit f7fbc7d

Please sign in to comment.