-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to customise theme breakpoints #26648
Comments
@robphoenix thanks for the report. Looks like I re-exported only the typings which were previously exported from index 67019cb6e5..64c2eaf38d 100644
--- a/packages/material-ui/src/styles/index.d.ts
+++ b/packages/material-ui/src/styles/index.d.ts
@@ -35,6 +35,9 @@ export {
Direction,
Breakpoint,
BreakpointOverrides,
+ BreakpointValues,
+ Breakpoints,
+ BreakpointsOptions,
CreateMUIStyled,
CSSObject,
} from '@material-ui/system';
In this case you would be able to do: -import { BreakpointsOptions } from "@material-ui/core/styles/createBreakpoints";
+import { BreakpointsOptions } from "@material-ui/core/styles";
const getBreakpoints = (theme: CustomerUITheme): BreakpointsOptions => ({
values: theme.breakpoints,
}); @eps1lon @oliviertassinari should we still support exports from modules like: |
We can for internal usage. They just aren't useable for the public but we probably should make that happen as well. |
I thought that we should support up to level 3, otherwise we are making public the folder structure that we have internally, which with changes like this will break 😕 Also not supporting levels bigger than 3 will allow us to have private types as well. |
The proposed patch looks great. I would even not make diff --git a/packages/material-ui-system/src/createTheme/createBreakpoints.d.ts b/packages/material-ui-system/src/createTheme/createBreakpoints.d.ts
index 6389985a74..3a9544acb7 100644
--- a/packages/material-ui-system/src/createTheme/createBreakpoints.d.ts
+++ b/packages/material-ui-system/src/createTheme/createBreakpoints.d.ts
@@ -6,12 +6,11 @@ export type Breakpoint = OverridableStringUnion<
'xs' | 'sm' | 'md' | 'lg' | 'xl',
BreakpointOverrides
>;
-export type BreakpointValues = { [key in Breakpoint]: number };
export const keys: Breakpoint[];
export interface Breakpoints {
keys: Breakpoint[];
- values: BreakpointValues;
+ values: { [key in Breakpoint]: number };
up: (key: Breakpoint | number) => string;
down: (key: Breakpoint | number) => string;
between: (start: Breakpoint | number, end: Breakpoint | number) => string; Regarding the side questions. |
I wanted to say that we should make it public via public path. So re-export it from something at level 2 or 3. Not tell people to export from level >=4 |
Got it, I misunderstood your comment. |
Current Behavior 😯
No longer able to customise theme breakpoints.
Expected Behavior 🤔
Be able to import the
BreakpointOptions
type from core and use it to pass in custom breakpoints to theme.Steps to Reproduce 🕹
https://codesandbox.io/s/basicalerts-material-demo-forked-7qnte?file=/demo.tsx:9-27
shows error
Cannot find module '@material-ui/core/styles/createBreakpoints
there doesn't appear to be any error passing breakpoints into the
createTheme
function, and i believecreateBreakpoints
has moved to the system package.Do we need to install
@material-ui/system
to be able to use theBreakpointsOptions
type?The text was updated successfully, but these errors were encountered: