Skip to content

Commit

Permalink
use new version of mui useMediaQuery hook
Browse files Browse the repository at this point in the history
  • Loading branch information
fzaninotto authored and djhi committed Aug 9, 2019
1 parent d26e025 commit 21f3cb4
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 65 deletions.
8 changes: 2 additions & 6 deletions examples/demo/src/layout/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ import { connect } from 'react-redux';
import compose from 'recompose/compose';
import SettingsIcon from '@material-ui/icons/Settings';
import LabelIcon from '@material-ui/icons/Label';
import { useMediaQuery } from '@material-ui/core';
import { withRouter } from 'react-router-dom';
import {
useTranslate,
DashboardMenuItem,
MenuItemLink,
useMediaQuery,
} from 'react-admin';
import { useTranslate, DashboardMenuItem, MenuItemLink } from 'react-admin';

import visitors from '../visitors';
import orders from '../orders';
Expand Down
3 changes: 1 addition & 2 deletions examples/demo/src/visitors/VisitorList.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ import {
NullableBooleanInput,
NumberField,
SearchInput,
useMediaQuery,
} from 'react-admin';
import { makeStyles } from '@material-ui/core/styles';
import { useMediaQuery, makeStyles } from '@material-ui/core';

import SegmentsField from './SegmentsField';
import SegmentInput from './SegmentInput';
Expand Down
22 changes: 12 additions & 10 deletions examples/simple/src/comments/CommentList.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ import React from 'react';
import ChevronLeft from '@material-ui/icons/ChevronLeft';
import ChevronRight from '@material-ui/icons/ChevronRight';
import PersonIcon from '@material-ui/icons/Person';
import Avatar from '@material-ui/core/Avatar';
import Button from '@material-ui/core/Button';
import Card from '@material-ui/core/Card';
import CardActions from '@material-ui/core/CardActions';
import CardContent from '@material-ui/core/CardContent';
import CardHeader from '@material-ui/core/CardHeader';
import Grid from '@material-ui/core/Grid';
import Toolbar from '@material-ui/core/Toolbar';
import { makeStyles } from '@material-ui/core/styles';
import {
Avatar,
Button,
Card,
CardActions,
CardContent,
CardHeader,
Grid,
Toolbar,
useMediaQuery,
makeStyles,
} from '@material-ui/core';
import jsonExport from 'jsonexport/dist';
import {
DateField,
Expand All @@ -27,7 +30,6 @@ import {
TextField,
downloadCSV,
useTranslate,
useMediaQuery,
} from 'react-admin'; // eslint-disable-line import/no-unresolved

const CommentFilter = props => (
Expand Down
3 changes: 1 addition & 2 deletions examples/simple/src/posts/PostList.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import BookIcon from '@material-ui/icons/Book';
import Chip from '@material-ui/core/Chip';
import { makeStyles } from '@material-ui/core/styles';
import { useMediaQuery, makeStyles } from '@material-ui/core';
import React, { Children, Fragment, cloneElement } from 'react';
import lodashGet from 'lodash/get';
import jsonExport from 'jsonexport/dist';
Expand All @@ -22,7 +22,6 @@ import {
SingleFieldList,
TextField,
TextInput,
useMediaQuery,
useTranslate,
} from 'react-admin'; // eslint-disable-line import/no-unresolved

Expand Down
3 changes: 1 addition & 2 deletions examples/simple/src/users/UserList.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint react/jsx-key: off */
import PeopleIcon from '@material-ui/icons/People';
import memoize from 'lodash/memoize';

import { useMediaQuery } from '@material-ui/core';
import React from 'react';
import {
BulkDeleteWithConfirmButton,
Expand All @@ -12,7 +12,6 @@ import {
SimpleList,
TextField,
TextInput,
useMediaQuery,
} from 'react-admin';

import Aside from './Aside';
Expand Down
10 changes: 2 additions & 8 deletions examples/tutorial/src/users.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import React from 'react';
import {
SimpleList,
List,
Datagrid,
EmailField,
TextField,
useMediaQuery,
} from 'react-admin';
import { useMediaQuery } from '@material-ui/core';
import { SimpleList, List, Datagrid, EmailField, TextField } from 'react-admin';

export const UserList = props => (
<List title="All users" {...props}>
Expand Down
13 changes: 7 additions & 6 deletions packages/ra-ui-materialui/src/button/Button.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React from 'react';
import PropTypes from 'prop-types';
import MuiButton from '@material-ui/core/Button';
import Tooltip from '@material-ui/core/Tooltip';
import IconButton from '@material-ui/core/IconButton';
import { makeStyles } from '@material-ui/core/styles';
import {
Button as MuiButton,
Tooltip,
IconButton,
useMediaQuery,
makeStyles,
} from '@material-ui/core';
import classnames from 'classnames';
import { useTranslate } from 'ra-core';

import { useMediaQuery } from '../layout';

const useStyles = makeStyles({
button: {
display: 'inline-flex',
Expand Down
8 changes: 6 additions & 2 deletions packages/ra-ui-materialui/src/button/CreateButton.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import React from 'react';
import PropTypes from 'prop-types';
import onlyUpdateForKeys from 'recompose/onlyUpdateForKeys';
import { Fab, createStyles, withStyles } from '@material-ui/core';
import {
Fab,
createStyles,
withStyles,
useMediaQuery,
} from '@material-ui/core';
import ContentAdd from '@material-ui/icons/Add';
import compose from 'recompose/compose';
import classnames from 'classnames';
import { Link } from 'react-router-dom';
import { useTranslate } from 'ra-core';

import Button from './Button';
import { useMediaQuery } from '../layout';

const styles = theme =>
createStyles({
Expand Down
3 changes: 1 addition & 2 deletions packages/ra-ui-materialui/src/layout/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import inflection from 'inflection';
import compose from 'recompose/compose';
import { withStyles, createStyles } from '@material-ui/core';
import { withStyles, createStyles, useMediaQuery } from '@material-ui/core';
import DefaultIcon from '@material-ui/icons/ViewList';
import classnames from 'classnames';
import { getResources, useTranslate } from 'ra-core';

import { useMediaQuery } from '../layout';
import DashboardMenuItem from './DashboardMenuItem';
import MenuItemLink from './MenuItemLink';

Expand Down
4 changes: 1 addition & 3 deletions packages/ra-ui-materialui/src/layout/Sidebar.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import React, { useEffect, Children, cloneElement } from 'react';
import PropTypes from 'prop-types';
import { useDispatch, useSelector } from 'react-redux';
import { Drawer, makeStyles } from '@material-ui/core';
import { Drawer, makeStyles, useMediaQuery } from '@material-ui/core';
import lodashGet from 'lodash/get';
import { setSidebarVisibility } from 'ra-core';

import { useMediaQuery } from '../layout';

export const DRAWER_WIDTH = 240;
export const CLOSED_DRAWER_WIDTH = 55;

Expand Down
2 changes: 0 additions & 2 deletions packages/ra-ui-materialui/src/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import Layout from './Layout';
import Loading from './Loading';
import LinearProgress from './LinearProgress';
import LoadingIndicator from './LoadingIndicator';
import useMediaQuery from './useMediaQuery';
import Menu from './Menu';
import MenuItemLink from './MenuItemLink';
import NotFound from './NotFound';
Expand Down Expand Up @@ -46,5 +45,4 @@ export {
TitlePropType,
TopToolbar,
UserMenu,
useMediaQuery,
};
18 changes: 0 additions & 18 deletions packages/ra-ui-materialui/src/layout/useMediaQuery.ts

This file was deleted.

3 changes: 1 addition & 2 deletions packages/ra-ui-materialui/src/list/Pagination.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { useEffect, useCallback } from 'react';
import PropTypes from 'prop-types';
import { TablePagination, Toolbar } from '@material-ui/core';
import { TablePagination, Toolbar, useMediaQuery } from '@material-ui/core';
import { useTranslate, sanitizeListRestProps } from 'ra-core';

import { useMediaQuery } from '../layout';
import PaginationActions from './PaginationActions';
import PaginationLimit from './PaginationLimit';

Expand Down

0 comments on commit 21f3cb4

Please sign in to comment.