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 da36e13
Show file tree
Hide file tree
Showing 29 changed files with 76 additions and 286 deletions.
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
3 changes: 1 addition & 2 deletions packages/material-ui-lab/src/internal/svg-icons/Add.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';

/**
Expand All @@ -11,7 +10,7 @@ let Add = props => (
</SvgIcon>
);

Add = pure(Add);
Add = React.memo(Add);
Add.muiName = 'SvgIcon';

export default Add;
1 change: 0 additions & 1 deletion packages/material-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"prop-types": "^15.6.0",
"react-event-listener": "^0.6.2",
"react-transition-group": "^2.2.1",
"recompose": "0.28.0 - 0.30.0",
"warning": "^4.0.1"
},
"sideEffects": false,
Expand Down
Loading

0 comments on commit da36e13

Please sign in to comment.