Skip to content

Commit

Permalink
import makestyles from material ui core
Browse files Browse the repository at this point in the history
  • Loading branch information
fzaninotto committed May 7, 2019
1 parent 7afd8e7 commit 32e22a9
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 36 deletions.
1 change: 0 additions & 1 deletion examples/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"private": true,
"dependencies": {
"@material-ui/core": "^4.0.0-beta.0",
"@material-ui/styles": "^4.0.0-beta.0",
"@material-ui/icons": "^4.0.0-beta.0",
"data-generator-retail": "^2.7.0",
"fakerest": "~2.1.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/src/dashboard/NewCustomers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Avatar from '@material-ui/core/Avatar';
import Typography from '@material-ui/core/Typography';
import CustomerIcon from '@material-ui/icons/PersonAdd';
import Divider from '@material-ui/core/Divider';
import { makeStyles } from '@material-ui/styles';
import { makeStyles } from '@material-ui/core/styles';
import { Link } from 'react-router-dom';
import { useTranslate, useQuery, GET_LIST } from 'react-admin';

Expand Down
2 changes: 1 addition & 1 deletion examples/demo/src/dashboard/PendingOrders.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
import ListItemAvatar from '@material-ui/core/ListItemAvatar';
import ListItemText from '@material-ui/core/ListItemText';
import Avatar from '@material-ui/core/Avatar';
import { makeStyles } from '@material-ui/styles';
import { makeStyles } from '@material-ui/core/styles';
import { Link } from 'react-router-dom';
import { useTranslate } from 'react-admin';

Expand Down
2 changes: 1 addition & 1 deletion examples/demo/src/dashboard/PendingReviews.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Avatar from '@material-ui/core/Avatar';
import Typography from '@material-ui/core/Typography';
import CommentIcon from '@material-ui/icons/Comment';
import Divider from '@material-ui/core/Divider';
import { makeStyles } from '@material-ui/styles';
import { makeStyles } from '@material-ui/core/styles';
import { Link } from 'react-router-dom';
import { useTranslate } from 'react-admin';

Expand Down
2 changes: 1 addition & 1 deletion examples/demo/src/layout/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import CardActions from '@material-ui/core/CardActions';
import CircularProgress from '@material-ui/core/CircularProgress';
import TextField from '@material-ui/core/TextField';
import { createMuiTheme, withStyles } from '@material-ui/core/styles';
import { ThemeProvider } from '@material-ui/styles';
import { ThemeProvider } from '@material-ui/core/styles';
import LockIcon from '@material-ui/icons/Lock';

import { Notification, useTranslate, translate, userLogin } from 'react-admin';
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/src/layout/SubMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ListItemIcon from '@material-ui/core/ListItemIcon';
import Typography from '@material-ui/core/Typography';
import Divider from '@material-ui/core/Divider';
import Collapse from '@material-ui/core/Collapse';
import { makeStyles } from '@material-ui/styles';
import { makeStyles } from '@material-ui/core/styles';

import { useTranslate } from 'react-admin';

Expand Down
2 changes: 1 addition & 1 deletion examples/demo/src/visitors/FullNameField.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { makeStyles } from '@material-ui/styles';
import { makeStyles } from '@material-ui/core/styles';
import pure from 'recompose/pure';

import AvatarField from './AvatarField';
Expand Down
1 change: 0 additions & 1 deletion examples/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"dependencies": {
"@babel/polyfill": "^7.0.0",
"@material-ui/core": "^4.0.0-beta.0",
"@material-ui/styles": "^4.0.0-beta.0",
"@material-ui/icons": "^4.0.0-beta.0",
"ra-data-fakerest": "^2.0.0",
"ra-input-rich-text": "^2.0.0",
Expand Down
1 change: 0 additions & 1 deletion examples/tutorial/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"private": true,
"dependencies": {
"@material-ui/core": "^4.0.0-beta.0",
"@material-ui/styles": "^4.0.0-beta.0",
"ra-data-json-server": "^2.0.0",
"react": "~16.8.0",
"react-admin": "^2.0.0",
Expand Down
53 changes: 26 additions & 27 deletions packages/ra-ui-materialui/src/auth/Logout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { useCallback, SFC } from 'react';
import React, { useCallback, FunctionComponent } from 'react';
import PropTypes from 'prop-types';
// @ts-ignore
import { useDispatch } from 'react-redux';
import MenuItem, { MenuItemProps } from '@material-ui/core/MenuItem';
import { makeStyles } from '@material-ui/styles';
import { Theme } from '@material-ui/core/styles';
import { makeStyles, Theme } from '@material-ui/core/styles';

import ExitIcon from '@material-ui/icons/PowerSettingsNew';
import classnames from 'classnames';
Expand Down Expand Up @@ -32,30 +31,30 @@ const useStyles = makeStyles((theme: Theme) => ({
*
* Used for the Logout Menu item in the sidebar
*/
const LogoutWithRef: SFC<Props & MenuItemProps> = React.forwardRef(
function Logout(props, ref) {
const { className, redirectTo, ...rest } = props;
const classes = useStyles();
const translate = useTranslate();
const dispatch = useDispatch();
const logout = useCallback(() => dispatch(userLogout(redirectTo)), [
redirectTo,
]);
return (
<MenuItem
className={classnames('logout', classes.menuItem, className)}
onClick={logout}
ref={ref}
{...rest}
>
<span className={classes.iconMenuPaddingStyle}>
<ExitIcon />
</span>
{translate('ra.auth.logout')}
</MenuItem>
);
}
);
const LogoutWithRef: FunctionComponent<
Props & MenuItemProps
> = React.forwardRef(function Logout(props, ref) {
const { className, redirectTo, ...rest } = props;
const classes = useStyles();
const translate = useTranslate();
const dispatch = useDispatch();
const logout = useCallback(() => dispatch(userLogout(redirectTo)), [
redirectTo,
]);
return (
<MenuItem
className={classnames('logout', classes.menuItem, className)}
onClick={logout}
ref={ref}
{...rest}
>
<span className={classes.iconMenuPaddingStyle}>
<ExitIcon />
</span>
{translate('ra.auth.logout')}
</MenuItem>
);
});

LogoutWithRef.propTypes = {
className: PropTypes.string,
Expand Down

0 comments on commit 32e22a9

Please sign in to comment.