Skip to content

Commit

Permalink
Add new palette colors to Framer ThemeProvider component
Browse files Browse the repository at this point in the history
  • Loading branch information
iKettles committed Jan 29, 2020
1 parent 3bce43e commit 8eed1f4
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion framer/Material-UI.framerfx/code/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,43 @@ interface Props {
primary?: string;
secondary?: string;
error?: string;
info?: string;
warning?: string;
success?: string;
}

const defaultProps: Props = {
paletteType: 'light',
primary: '#3f51b5',
secondary: '#f50057',
error: '#f44336',
info: '#2196f3',
warning: '#ff9800',
success: '#4caf4f',
};

export const Theme: React.SFC<Props> = (props: Props) => {
const { children, error, paletteType, primary, secondary, ...other } = props;
const {
children,
error,
paletteType,
primary,
secondary,
info,
warning,
success,
...other
} = props;

const theme = createMuiTheme({
palette: {
type: paletteType,
primary: { main: parseColor(primary) },
secondary: { main: parseColor(secondary) },
error: { main: parseColor(error) },
info: { main: parseColor(info) },
warning: { main: parseColor(warning) },
success: { main: parseColor(success) },
},
});

Expand Down Expand Up @@ -58,4 +77,16 @@ addPropertyControls(Theme, {
type: ControlType.Color,
title: 'Error',
},
info: {
type: ControlType.Color,
title: 'Info',
},
warning: {
type: ControlType.Color,
title: 'Warning',
},
success: {
type: ControlType.Color,
title: 'Success',
},
});

0 comments on commit 8eed1f4

Please sign in to comment.