Skip to content

Commit

Permalink
#14 Merging Canvas and theme props to single object
Browse files Browse the repository at this point in the history
  • Loading branch information
vidhya-metacell committed Jul 22, 2022
1 parent 29e4ff9 commit 141d322
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
7 changes: 6 additions & 1 deletion example/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ const App = () => {

return (
<div className={classes.main}>
<MetaDiagram metaNodes={[node1, node2]} metaLinks={[link3]} componentsMap={componentsMap} customThemeVariables={{}} canvasClassName={classes.canvasBG}/>
<MetaDiagram metaNodes={[node1, node2]} metaLinks={[link3]} componentsMap={componentsMap}
metaTheme={{
customThemeVariables: {},
canvasClassName: classes.canvasBG,
}}
/>
</div>
);
};
Expand Down
12 changes: 7 additions & 5 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,18 @@ interface MetaDiagramProps {
componentsMap: ComponentsMap;
wrapperClassName?: string;
canvasClassName?: string;
customThemeVariables: object;
metaTheme: {
customThemeVariables: {};
canvasClassName: string;
};
}

const MetaDiagram = ({
metaNodes,
metaLinks,
componentsMap,
wrapperClassName,
canvasClassName,
customThemeVariables,
metaTheme,
}: MetaDiagramProps) => {
const classes = useStyles();

Expand Down Expand Up @@ -79,12 +81,12 @@ const MetaDiagram = ({
: classes.container;

return (
<ThemeProvider theme={createTheme(theme(customThemeVariables))}>
<ThemeProvider theme={createTheme(theme(metaTheme?.customThemeVariables))}>
<CssBaseline />
<Box className={containerClassName}>
<Sidebar />
<CanvasWidget
className={`${classes.canvasContainer} ${canvasClassName}`}
className={`${classes.canvasContainer} ${metaTheme?.canvasClassName}`}
engine={engine}
/>
</Box>
Expand Down

0 comments on commit 141d322

Please sign in to comment.