Skip to content

Commit

Permalink
Remove Divider inset prop
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwooding committed Mar 10, 2019
1 parent a5b8011 commit 1a39c22
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 48 deletions.
2 changes: 0 additions & 2 deletions docs/src/pages/demos/dividers/dividers.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ The examples below show two ways of achieving this.

## Inset Dividers

The `inset` property has now been deprecated. You should now use `variant="inset"`.

{{"demo": "pages/demos/dividers/InsetDividers.js"}}

## Subheader Dividers
Expand Down
1 change: 0 additions & 1 deletion packages/material-ui/src/Divider/Divider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export interface DividerProps
extends StandardProps<React.HTMLAttributes<HTMLHRElement>, DividerClassKey> {
absolute?: boolean;
component?: React.ReactType<DividerProps>;
inset?: boolean;
light?: boolean;
variant?: 'fullWidth' | 'inset' | 'middle';
}
Expand Down
30 changes: 2 additions & 28 deletions packages/material-ui/src/Divider/Divider.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { chainPropTypes } from '@material-ui/utils';
import withStyles from '../styles/withStyles';
import { fade } from '../styles/colorManipulator';

Expand Down Expand Up @@ -37,23 +36,14 @@ export const styles = theme => ({
});

const Divider = React.forwardRef(function Divider(props, ref) {
const {
absolute,
classes,
className,
component: Component,
inset,
light,
variant,
...other
} = props;
const { absolute, classes, className, component: Component, light, variant, ...other } = props;

return (
<Component
className={clsx(
classes.root,
{
[classes.inset]: inset || variant === 'inset',
[classes.inset]: variant === 'inset',
[classes.middle]: variant === 'middle',
[classes.absolute]: absolute,
[classes.light]: light,
Expand Down Expand Up @@ -85,22 +75,6 @@ Divider.propTypes = {
* Either a string to use a DOM element or a component.
*/
component: PropTypes.elementType,
/**
* If `true`, the divider will be indented.
* __WARNING__: `inset` is deprecated.
* Instead use `variant="inset"`.
*/
inset: chainPropTypes(PropTypes.bool, props => {
if (props.inset) {
return new Error(
'Material-UI: you are using the deprecated `inset` property ' +
'that will be removed in the next major release. The property `variant="inset"` ' +
'is equivalent and should be used instead.',
);
}

return null;
}),
/**
* If `true`, the divider will have a lighter color.
*/
Expand Down
16 changes: 0 additions & 16 deletions packages/material-ui/src/Divider/Divider.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import { assert } from 'chai';
import { createShallow, getClasses } from '@material-ui/core/test-utils';
import Divider from './Divider';
import consoleErrorMock from 'test/utils/consoleErrorMock';

describe('<Divider />', () => {
let shallow;
Expand Down Expand Up @@ -33,21 +32,6 @@ describe('<Divider />', () => {
assert.strictEqual(wrapper.hasClass(classes.light), true);
});

describe('prop: inset', () => {
before(() => {
consoleErrorMock.spy();
});

after(() => {
consoleErrorMock.reset();
});

it('should set the inset class', () => {
const wrapper = shallow(<Divider inset />);
assert.strictEqual(wrapper.hasClass(classes.inset), true);
});
});

describe('prop: variant', () => {
it('should default to variant="fullWidth"', () => {
const wrapper = shallow(<Divider />);
Expand Down
1 change: 0 additions & 1 deletion pages/api/divider.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import Divider from '@material-ui/core/Divider';
| <span class="prop-name">absolute</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | Absolutely position the element. |
| <span class="prop-name">classes</span> | <span class="prop-type">object</span> |   | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. |
| <span class="prop-name">component</span> | <span class="prop-type">elementType</span> | <span class="prop-default">'hr'</span> | The component used for the root node. Either a string to use a DOM element or a component. |
| <span class="prop-name">inset</span> | <span class="prop-type">bool</span> |   | If `true`, the divider will be indented. __WARNING__: `inset` is deprecated. Instead use `variant="inset"`. |
| <span class="prop-name">light</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, the divider will have a lighter color. |
| <span class="prop-name">variant</span> | <span class="prop-type">enum:&nbsp;'fullWidth'&nbsp;&#124;<br>&nbsp;'inset'&nbsp;&#124;<br>&nbsp;'middle'<br></span> | <span class="prop-default">'fullWidth'</span> | The variant to use. |

Expand Down

0 comments on commit 1a39c22

Please sign in to comment.