Skip to content

Commit

Permalink
[core] Remove recompose
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Feb 10, 2019
1 parent 0ebe81d commit 5bc45b2
Show file tree
Hide file tree
Showing 34 changed files with 89 additions and 295 deletions.
6 changes: 3 additions & 3 deletions .size-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = [
name: 'The size of the @material-ui/core modules',
webpack: true,
path: 'packages/material-ui/build/index.js',
limit: '92.4 KB',
limit: '91.9 KB',
},
{
name: 'The theme object',
Expand All @@ -40,7 +40,7 @@ module.exports = [
name: 'The size of the @material-ui/styles modules',
webpack: true,
path: 'packages/material-ui-styles/build/index.js',
limit: '16.4 KB',
limit: '16.3 KB',
},
{
name: 'The size of the @material-ui/system modules',
Expand Down Expand Up @@ -87,7 +87,7 @@ module.exports = [
name: 'The main docs bundle',
webpack: false,
path: main.path,
limit: '194 KB',
limit: '193 KB',
},
{
name: 'The docs home page',
Expand Down
42 changes: 0 additions & 42 deletions docs/src/pages/demos/menus/RenderPropsMenu.js

This file was deleted.

7 changes: 0 additions & 7 deletions docs/src/pages/demos/menus/menus.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ If the height of a menu prevents all menu items from being displayed, the menu c

{{"demo": "pages/demos/menus/LongMenu.js"}}

## Render Props

It is a [render props](https://reactjs.org/docs/render-props.html) demo that
keeps track of the local state for a single menu.

{{"demo": "pages/demos/menus/RenderPropsMenu.js"}}

## Limitations

There is [a flexbox bug](https://bugs.chromium.org/p/chromium/issues/detail?id=327437) that prevents `text-overflow: ellipsis` from working in a flexbox layout.
Expand Down
16 changes: 0 additions & 16 deletions docs/src/pages/layout/breakpoints/RenderPropsWithWidth.js

This file was deleted.

22 changes: 0 additions & 22 deletions docs/src/pages/layout/breakpoints/breakpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,28 +78,6 @@ In the following demo, we change the rendered DOM element (*em*, <u>u</u>, ~~del

{{"demo": "pages/layout/breakpoints/WithWidth.js"}}

#### Render Props

In some cases, you can experience property name collisions using higher-order components.
To avoid this, you can use the [render props](https://reactjs.org/docs/render-props.html) pattern shown in the following demo.

```jsx
import Typography from '@material-ui/core/Typography';
import toRenderProps from 'recompose/toRenderProps';

const WithWidth = toRenderProps(withWidth());

export default function MyComponent() {
return (
<WithWidth>
{({ width }) => <div>{`Current width: ${width}`}</div>}
</WithWidth>
);
}
```

{{"demo": "pages/layout/breakpoints/RenderPropsWithWidth.js"}}

## API

### `theme.breakpoints.up(key) => media query`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import pure from 'recompose/pure';
import { withStyles } from '@material-ui/core/styles';
import Grid from '@material-ui/core/Grid';
import Link from '@material-ui/core/Link';
Expand Down Expand Up @@ -152,6 +151,6 @@ AppFooter.propTypes = {
};

export default compose(
pure,
React.memo,
withStyles(styles),
)(AppFooter);
66 changes: 0 additions & 66 deletions docs/src/pages/utils/popover/RenderPropsPopover.js

This file was deleted.

53 changes: 53 additions & 0 deletions docs/src/pages/utils/popover/SimplePopover.hooks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import React from 'react';
import { makeStyles } from '@material-ui/styles';
import Popover from '@material-ui/core/Popover';
import Typography from '@material-ui/core/Typography';
import Button from '@material-ui/core/Button';

const useStyles = makeStyles(theme => ({
typography: {
padding: theme.spacing(2),
},
}));

function SimplePopover() {
const classes = useStyles();
const [anchorEl, setAnchorEl] = React.useState(null);

function handleClick(event) {
setAnchorEl(event.currentTarget);
}

function handleClose() {
setAnchorEl(null);
}

const open = Boolean(anchorEl);
const id = open ? 'simple-popover' : null;

return (
<div>
<Button aria-describedby={id} variant="contained" onClick={handleClick}>
Open Popover
</Button>
<Popover
id={id}
open={open}
anchorEl={anchorEl}
onClose={handleClose}
anchorOrigin={{
vertical: 'bottom',
horizontal: 'center',
}}
transformOrigin={{
vertical: 'top',
horizontal: 'center',
}}
>
<Typography className={classes.typography}>The content of the Popover.</Typography>
</Popover>
</div>
);
}

export default SimplePopover;
4 changes: 2 additions & 2 deletions docs/src/pages/utils/popover/SimplePopover.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ class SimplePopover extends React.Component {
return (
<div>
<Button
aria-owns={open ? 'simple-popper' : undefined}
aria-owns={open ? 'simple-popover' : undefined}
aria-haspopup="true"
variant="contained"
onClick={this.handleClick}
>
Open Popover
</Button>
<Popover
id="simple-popper"
id="simple-popover"
open={open}
anchorEl={anchorEl}
onClose={this.handleClose}
Expand Down
7 changes: 0 additions & 7 deletions docs/src/pages/utils/popover/popover.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ We demonstrate how to use the `Popover` component to implement a popover behavio

{{"demo": "pages/utils/popover/MouseOverPopover.js"}}

## Render Props

It is a [render props](https://reactjs.org/docs/render-props.html) demo that
keeps track of the local state for a single popover.

{{"demo": "pages/utils/popover/RenderPropsPopover.js"}}

## Complementary projects

For more advanced use cases you might be able to take advantage of:
Expand Down
61 changes: 0 additions & 61 deletions docs/src/pages/utils/popper/RenderPropsPopper.js

This file was deleted.

7 changes: 0 additions & 7 deletions docs/src/pages/utils/popper/popper.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@ Highlight part of the text to see the popper:

{{"demo": "pages/utils/popper/FakedReferencePopper.js"}}

## Render Props

It is a [render props](https://reactjs.org/docs/render-props.html) demo that
keeps track of the local state for a single popper.

{{"demo": "pages/utils/popper/RenderPropsPopper.js"}}

## Complementary projects

For more advanced use cases you might be able to take advantage of:
Expand Down
3 changes: 1 addition & 2 deletions packages/material-ui-icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
"react-dom": "^16.8.0"
},
"dependencies": {
"@babel/runtime": "^7.2.0",
"recompose": "0.28.0 - 0.30.0"
"@babel/runtime": "^7.2.0"
},
"devDependencies": {
"fs-extra": "^7.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/material-ui-icons/src/utils/createSvgIcon.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '@material-ui/core/SvgIcon';

function createSvgIcon(path, displayName) {
Expand All @@ -10,7 +9,7 @@ function createSvgIcon(path, displayName) {
);

Icon.displayName = `${displayName}Icon`;
Icon = pure(Icon);
Icon = React.memo(Icon);
Icon.muiName = 'SvgIcon';

return Icon;
Expand Down
Loading

0 comments on commit 5bc45b2

Please sign in to comment.