Skip to content

Commit bbf455f

Browse files
committedOct 12, 2018
Fix export graph
1 parent e2e07e6 commit bbf455f

File tree

4 files changed

+24
-36
lines changed

4 files changed

+24
-36
lines changed
 

‎index.js

+1-23
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,3 @@
11
// This file is not processed by check_flow.py script
2-
import React from 'react'
32
import DiagramEditor from './src'
4-
import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles'
5-
import CssBaseline from '@material-ui/core/CssBaseline'
6-
7-
const theme = createMuiTheme({
8-
typography: {
9-
useNextVariants: true,
10-
},
11-
})
12-
13-
// MuiThemeProvider uses ref, which can be used only with statefull components
14-
class Editor extends React.Component {
15-
render() {
16-
return (
17-
<MuiThemeProvider theme={theme}>
18-
<CssBaseline>
19-
<DiagramEditor {...this.props} />
20-
</CssBaseline>
21-
</MuiThemeProvider>
22-
)
23-
}
24-
}
25-
export default Editor
3+
export default DiagramEditor

‎src/diagramEditor/mainEditor/widgets/Widget.js

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import Tooltip from '@material-ui/core/Tooltip'
1111
import { WIDGET_ICON_MODE_TRASHHOLD } from '../../../constants'
1212
import { withSchemaCommandContext } from '../../SchemaContext'
1313

14-
// TODO: We get a warning about variant not being recognized because of
15-
// https://github.com/mui-org/material-ui/issues/13145
1614
const WholeWidget = ({
1715
className,
1816
editorKey,

‎src/diagramEditor/topPanel/TopPanel.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const TopPanel = ({
4242
}) => (
4343
<AppBar position="static" className="TopPanel">
4444
<Toolbar variant="dense">
45-
<Typography variant="title" color="inherit">
45+
<Typography variant="h6" color="inherit">
4646
Diagrams
4747
</Typography>
4848

‎src/index.js

+22-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
// @flow
22
import * as React from 'react'
33
import { Provider } from 'react-redux'
4+
import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles'
5+
import CssBaseline from '@material-ui/core/CssBaseline'
46
import DiagramEditor from './diagramEditor/DiagramEditor'
57
import getConfiguredStore from './configureStore'
68

9+
import type { ExportedGraph } from './diagramEditor/editorApi'
710
import type { DiagramEditorApi } from './diagramEditor/DiagramEditor'
811
import type { Schema } from './flow/schemaTypes'
9-
import type { ExportedGraph } from './diagramEditor/editorApi'
1012

1113
const store = getConfiguredStore()
1214

1315
type DiagramEditorRef = { getWrappedInstance: () => DiagramEditorApi }
1416

17+
const theme = createMuiTheme({
18+
typography: {
19+
useNextVariants: true,
20+
},
21+
})
22+
1523
export class DiagramEditorWrapper extends React.Component<Schema> {
1624
editorRef: ?DiagramEditorApi
1725

@@ -22,15 +30,19 @@ export class DiagramEditorWrapper extends React.Component<Schema> {
2230

2331
render(): React.Node {
2432
return (
25-
<Provider store={store}>
26-
<DiagramEditor
27-
// FLOW: flow doesn't understand getWrappedInstance from connectAdvanced
28-
ref={(ref: DiagramEditorRef) => {
29-
this.editorRef = ref.getWrappedInstance()
30-
}}
31-
{...this.props}
32-
/>
33-
</Provider>
33+
<MuiThemeProvider theme={theme}>
34+
<CssBaseline>
35+
<Provider store={store}>
36+
<DiagramEditor
37+
// FLOW: flow doesn't understand getWrappedInstance from connectAdvanced
38+
ref={(ref: DiagramEditorRef) => {
39+
this.editorRef = ref.getWrappedInstance()
40+
}}
41+
{...this.props}
42+
/>
43+
</Provider>
44+
</CssBaseline>
45+
</MuiThemeProvider>
3446
)
3547
}
3648
}

0 commit comments

Comments
 (0)
Please sign in to comment.