Skip to content
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

Baseline/mui v3 v4 #34

Draft
wants to merge 10 commits into
base: baseline/master
Choose a base branch
from
Prev Previous commit
Next Next commit
Fixed Theme type in rapid, updated flow-typed v4
liringlas committed Jul 10, 2020
commit 703f12a229ef2a521cec6a0177f0c41c07ee9608
10 changes: 4 additions & 6 deletions js/flow-typed/material-ui-core-4.x.x.js
Original file line number Diff line number Diff line change
@@ -812,7 +812,7 @@ declare module "@material-ui/core/styles/createMuiTheme" {

declare export type Direction = "ltr" | "rtl";

declare export type ThemeOptions = {
declare export type ThemeOptions = {|
shape?: ShapeOptions,
breakpoints?: BreakpointsOptions,
direction?: Direction,
@@ -826,9 +826,9 @@ declare module "@material-ui/core/styles/createMuiTheme" {
typography?: TypographyOptions | ((palette: Palette) => TypographyOptions),
zIndex?: ZIndexOptions,
unstable_strictMode?: boolean,
};
|};

declare export type Theme = {
declare export type Theme = {|
shape: Shape,
breakpoints: Breakpoints,
direction: Direction,
@@ -842,9 +842,7 @@ declare module "@material-ui/core/styles/createMuiTheme" {
typography: Typography,
zIndex: ZIndex,
unstable_strictMode?: boolean,

[key: string]: any,
};
|};

declare export default function createMuiTheme(
options?: ThemeOptions,
61 changes: 33 additions & 28 deletions js/rex-ui/rapid/themes.js
Original file line number Diff line number Diff line change
@@ -15,9 +15,9 @@ import green from "@material-ui/core/colors/green";
import red from "@material-ui/core/colors/red";
import yellow from "@material-ui/core/colors/yellow";

export type Theme = {|
export type Theme = {
...ThemeBase,
status: {
status: $Shape<{
successText: color,
successBackground: color,
errorText: color,
@@ -26,8 +26,8 @@ export type Theme = {|
inProgressBackground: color,
warningText: color,
warningBackground: color,
},
|};
}>,
};

export let makeStyles: <Styles: {}>(
styles: (Theme) => Styles,
@@ -39,13 +39,16 @@ export let ThemeProvider: React.AbstractComponent<{|
theme: Theme,
|}> = (ThemeProviderBase: any);

export const DEFAULT_THEME: Theme = createMuiTheme({
palette: {
secondary: deepPurple,
},
typography: {
useNextVariants: true,
},
export const DEFAULT_THEME: Theme = {
...createMuiTheme({
palette: {
secondary: deepPurple,
},
typography: {
useNextVariants: true,
},
}),

status: {
successText: green[500],
successBackground: green[50],
@@ -56,24 +59,26 @@ export const DEFAULT_THEME: Theme = createMuiTheme({
warningText: yellow[800],
warningBackground: yellow[50],
},
});
};

export const DARK_THEME: Theme = createMuiTheme({
palette: {
primary: {
main: "rgb(128,128,128)",
dark: "rgb(66,66,66)",
contrastText: "white",
export const DARK_THEME: Theme = {
...createMuiTheme({
palette: {
primary: {
main: "rgb(128,128,128)",
dark: "rgb(66,66,66)",
contrastText: "white",
},
secondary: brown,
},
secondary: brown,
},
typography: {
useNextVariants: true,
},
}),
status: {
success: green[500],
error: red[500],
inProgress: blue[500],
warning: yellow[500],
},
typography: {
useNextVariants: true,
successBackground: green[500],
errorBackground: red[500],
inProgressBackground: blue[500],
warningBackground: yellow[500],
},
});
};