Skip to content

Commit

Permalink
[theme] Remove theme.breakpoints.width helper (#25918)
Browse files Browse the repository at this point in the history
  • Loading branch information
m4theushw committed Apr 24, 2021
1 parent a3baab4 commit a7e98e3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
7 changes: 7 additions & 0 deletions docs/src/pages/guides/migration-v4/migration-v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ export default function PlainCssPriority() {
+<Hidden mdDown>{...}</Hidden> // '@media (min-width:600px)'
```

- The `theme.breakpoints.width` utility was removed because it's redundant. Use `theme.breakpoints.values` to get the same values.

```diff
-theme.breakpoints.width('md')
+theme.breakpoints.values.md
```

- The signature of `theme.palette.augmentColor` helper has changed:

```diff
Expand Down
1 change: 0 additions & 1 deletion packages/material-ui/src/styles/createBreakpoints.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export interface Breakpoints {
down: (key: Breakpoint | number) => string;
between: (start: Breakpoint | number, end: Breakpoint | number) => string;
only: (key: Breakpoint) => string;
width: (key: Breakpoint) => number;
}

export type BreakpointsOptions = Partial<
Expand Down
5 changes: 0 additions & 5 deletions packages/material-ui/src/styles/createBreakpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,13 @@ export default function createBreakpoints(breakpoints) {
return up(key);
}

function width(key) {
return values[key];
}

return {
keys,
values,
up,
down,
between,
only,
width,
unit,
...other,
};
Expand Down
10 changes: 0 additions & 10 deletions packages/material-ui/src/styles/createBreakpoints.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,4 @@ describe('createBreakpoints', () => {
);
});
});

describe('width', () => {
it('should work', () => {
expect(breakpoints.width('md')).to.equal(960);
});

it('should work for custom breakpoints', () => {
expect(customBreakpoints.width('tablet')).to.equal(640);
});
});
});

0 comments on commit a7e98e3

Please sign in to comment.