Skip to content

Commit

Permalink
Merge pull request #6918 from AntoineCrb/update-docs
Browse files Browse the repository at this point in the history
update docs & example : createMuiTheme is out of date
  • Loading branch information
fzaninotto authored Dec 2, 2021
2 parents 5395b13 + 13909d9 commit d5bfda4
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions docs/Admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ See the [Theming documentation](./Theming.md#using-a-custom-menu) for more detai
Material UI supports [theming](https://v4.mui.com/customization/themes). This lets you customize the look and feel of an admin by overriding fonts, colors, and spacing. You can provide a custom material ui theme by using the `theme` prop:

```jsx
import { createMuiTheme } from '@material-ui/core/styles';
import { createTheme } from '@material-ui/core/styles';

const theme = createMuiTheme({
const theme = createTheme({
palette: {
type: 'dark', // Switching the dark mode on is a single property value change.
},
Expand Down
8 changes: 4 additions & 4 deletions docs/Authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ import * as React from 'react';
import { useState } from 'react';
import { useLogin, useNotify, Notification, defaultTheme } from 'react-admin';
import { ThemeProvider } from '@material-ui/styles';
import { createMuiTheme } from '@material-ui/core/styles';
import { createTheme } from '@material-ui/core/styles';

const MyLoginPage = ({ theme }) => {
const [email, setEmail] = useState('');
Expand All @@ -642,7 +642,7 @@ const MyLoginPage = ({ theme }) => {
};

return (
<ThemeProvider theme={createMuiTheme(defaultTheme)}>
<ThemeProvider theme={createTheme(defaultTheme)}>
<form onSubmit={submit}>
<input
name="email"
Expand Down Expand Up @@ -942,7 +942,7 @@ import * as React from 'react';
import { useState } from 'react';
import { useLogin, useNotify, Notification, defaultTheme } from 'react-admin';
import { ThemeProvider } from '@material-ui/styles';
import { createMuiTheme } from '@material-ui/core/styles';
import { createTheme } from '@material-ui/core/styles';
const MyLoginPage = ({ theme }) => {
const [email, setEmail] = useState('');
Expand All @@ -957,7 +957,7 @@ const MyLoginPage = ({ theme }) => {
};
return (
<ThemeProvider theme={createMuiTheme(defaultTheme)}>
<ThemeProvider theme={createTheme(defaultTheme)}>
<form onSubmit={submit}>
<input
name="email"
Expand Down
4 changes: 2 additions & 2 deletions docs/CustomApp.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ import restProvider from 'ra-data-simple-rest';
import defaultMessages from 'ra-language-english';
import polyglotI18nProvider from 'ra-i18n-polyglot';
+import { ThemeProvider } from '@material-ui/styles';
+import { createMuiTheme } from "@material-ui/core/styles";
+import { createTheme } from "@material-ui/core/styles";
+import AppBar from '@material-ui/core/AppBar';
+import Toolbar from '@material-ui/core/Toolbar';
+import Typography from '@material-ui/core/Typography';
Expand All @@ -186,7 +186,7 @@ const i18nProvider = polyglotI18nProvider(locale => {
return defaultMessages;
});
const history = createHashHistory();
const theme = createMuiTheme();
const theme = createTheme();

const App = () => (
<Provider
Expand Down
10 changes: 5 additions & 5 deletions docs/Theming.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,12 @@ export const PostList = (props) => {

## Using a Predefined Theme

Material UI also supports [complete theming](https://v4.mui.com/customization/themes) out of the box. Material UI ships two base themes: light and dark. React-admin uses the light one by default. To use the dark one, pass it to the `<Admin>` component, in the `theme` prop (along with `createMuiTheme()`).
Material UI also supports [complete theming](https://v4.mui.com/customization/themes) out of the box. Material UI ships two base themes: light and dark. React-admin uses the light one by default. To use the dark one, pass it to the `<Admin>` component, in the `theme` prop (along with `createTheme()`).

```jsx
import { createMuiTheme } from '@material-ui/core/styles';
import { createTheme } from '@material-ui/core/styles';

const theme = createMuiTheme({
const theme = createTheme({
palette: {
type: 'dark', // Switching the dark mode on is a single property value change.
},
Expand Down Expand Up @@ -446,9 +446,9 @@ You can specify the `Sidebar` width by setting the `width` and `closedWidth` pro

```jsx
import { defaultTheme } from "react-admin";
import { createMuiTheme } from '@material-ui/core/styles';
import { createTheme } from '@material-ui/core/styles';

const theme = createMuiTheme({
const theme = createTheme({
...defaultTheme,
sidebar: {
width: 300, // The default value is 240
Expand Down
4 changes: 2 additions & 2 deletions examples/crm/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { Admin, Resource, ListGuesser, defaultTheme } from 'react-admin';
import {
unstable_createMuiStrictModeTheme,
createMuiTheme,
createTheme,
} from '@material-ui/core/styles';

import { dataProvider } from './dataProvider';
Expand All @@ -17,7 +17,7 @@ import { Dashboard } from './dashboard/Dashboard';
const theme =
process.env.NODE_ENV !== 'production'
? unstable_createMuiStrictModeTheme(defaultTheme)
: createMuiTheme(defaultTheme);
: createTheme(defaultTheme);

const App = () => (
<Admin
Expand Down
4 changes: 2 additions & 2 deletions examples/crm/src/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component, ErrorInfo, HtmlHTMLAttributes } from 'react';
import PropTypes from 'prop-types';
import { RouteComponentProps, withRouter } from 'react-router-dom';
import { createMuiTheme } from '@material-ui/core/styles';
import { createTheme } from '@material-ui/core/styles';
import { ThemeProvider } from '@material-ui/styles';
import { CssBaseline, Container } from '@material-ui/core';
import { CoreLayoutProps } from 'react-admin';
Expand Down Expand Up @@ -43,7 +43,7 @@ class Layout extends Component<LayoutProps, LayoutState> {
const { hasError, errorMessage, errorInfo } = this.state;
return (
// @ts-ignore
<ThemeProvider theme={createMuiTheme(theme)}>
<ThemeProvider theme={createTheme(theme)}>
<CssBaseline />
<Header />
<Container>
Expand Down
4 changes: 2 additions & 2 deletions examples/demo/src/layout/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
CircularProgress,
TextField,
} from '@material-ui/core';
import { createMuiTheme, makeStyles } from '@material-ui/core/styles';
import { createTheme, makeStyles } from '@material-ui/core/styles';
import { ThemeProvider } from '@material-ui/styles';
import LockIcon from '@material-ui/icons/Lock';
import { Notification, useTranslate, useLogin, useNotify } from 'react-admin';
Expand Down Expand Up @@ -199,7 +199,7 @@ Login.propTypes = {
// Because otherwise the useStyles() hook used in Login won't get
// the right theme
const LoginWithTheme = (props: any) => (
<ThemeProvider theme={createMuiTheme(lightTheme)}>
<ThemeProvider theme={createTheme(lightTheme)}>
<Login {...props} />
</ThemeProvider>
);
Expand Down
4 changes: 2 additions & 2 deletions examples/no-code/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { Root } from 'ra-no-code';
import { defaultTheme } from 'react-admin';
import {
unstable_createMuiStrictModeTheme,
createMuiTheme,
createTheme,
} from '@material-ui/core/styles';

// FIXME MUI bug https://github.com/mui-org/material-ui/issues/13394
const theme =
process.env.NODE_ENV !== 'production'
? unstable_createMuiStrictModeTheme(defaultTheme)
: createMuiTheme(defaultTheme);
: createTheme(defaultTheme);

ReactDOM.render(
<React.StrictMode>
Expand Down

0 comments on commit d5bfda4

Please sign in to comment.