demoApp.jsx 3.49 KB
Newer Older
Patrik Meijer's avatar
Patrik Meijer committed
1
2
3
4
5
6
/* global window */
import React, {Component} from 'react';
import ExpansionPanel from '@material-ui/core/ExpansionPanel';
import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary';
import Typography from '@material-ui/core/Typography';

7
8
9
import {DragDropContext} from 'react-dnd';
import HTML5Backend from 'react-dnd-html5-backend';

Tamas Kecskes's avatar
Tamas Kecskes committed
10

Patrik Meijer's avatar
Patrik Meijer committed
11
12
import DemoProjectSeedCards from '../src/components/ProjectSeedCards/demo';
import DemoAttributeEditor from '../src/components/AttributeEditor/demo';
Patrik Meijer's avatar
Patrik Meijer committed
13
import DemoConfirmDialog from '../src/components/ConfirmDialog/demo';
14
import DemoUserProfileNavigator from '../src/components/UserProfileNavigator/demo';
Tamas Kecskes's avatar
Tamas Kecskes committed
15
16
import DemoModalSpinner from '../src/components/ModalSpinner/demo';
import DemoContainmentCanvas from '../src/components/ContainmentCanvas/demo';
17
import DemoBasicContainmentCanvas from '../src/components/BasicContainmentCanvas/demo';
18
import DemoSingleConnectedNode from '../src/components/SingleConnectedNode/demo';
Patrik Meijer's avatar
Patrik Meijer committed
19
import DemoInfoCard from '../src/components/InfoCard/demo';
Patrik Meijer's avatar
Patrik Meijer committed
20
import DemoPartBrowser from '../src/components/PartBrowser/demo';
Patrik Meijer's avatar
Patrik Meijer committed
21
import DemoGraphEditor from '../src/components/GraphEditor/demo';
22
23
24


class demoApp extends Component {
Patrik Meijer's avatar
Patrik Meijer committed
25
26
27
28
29
30
31
32
33
34
    componentDidMount() {
        window.onGMEInit = () => {
            window.gmeClient = new window.GME.classes.Client(window.GME.gmeConfig);
        };
    }

    render() {
        const DEMOS = [
            {
                component: <DemoAttributeEditor/>,
Patrik Meijer's avatar
Patrik Meijer committed
35
                title: 'AttributeEditor',
Patrik Meijer's avatar
Patrik Meijer committed
36
37
38
            },
            {
                component: <DemoProjectSeedCards/>,
Patrik Meijer's avatar
Patrik Meijer committed
39
40
41
42
43
                title: 'ProjectSeedCards',
            },
            {
                component: <DemoConfirmDialog/>,
                title: 'ConfirmDialog',
Patrik Meijer's avatar
Patrik Meijer committed
44
            },
45
46
47
48
            {
                component: <DemoUserProfileNavigator/>,
                title: 'UserProfileNavigator',
            },
Tamas Kecskes's avatar
Tamas Kecskes committed
49
50
51
52
            {
                component: <DemoModalSpinner/>,
                title: 'ModalSpinner',
            },
53
54
55
56
57
            {
                component: <DemoBasicContainmentCanvas/>,
                title: 'BasicContainmentCanvas',
                height: 400,
            },
58
59
60
            {
                component: <DemoContainmentCanvas/>,
                title: 'ContainmentCanvas',
Patrik Meijer's avatar
Patrik Meijer committed
61
                height: 400,
62
            },
63
            {
64
65
                component: <DemoSingleConnectedNode/>,
                title: 'SingleConnectedNode',
66
            },
Tamas Kecskes's avatar
Tamas Kecskes committed
67
68
69
            {
                component: <DemoInfoCard/>,
                title: 'InfoCard',
Patrik Meijer's avatar
Patrik Meijer committed
70
                height: 200,
Tamas Kecskes's avatar
Tamas Kecskes committed
71
            },
Patrik Meijer's avatar
Patrik Meijer committed
72
73
74
75
            {
                component: <DemoPartBrowser/>,
                title: 'PartBrowser',
            },
Patrik Meijer's avatar
Patrik Meijer committed
76
77
78
79
            {
                component: <DemoGraphEditor/>,
                title: 'GraphEditor',
            },
Patrik Meijer's avatar
Patrik Meijer committed
80
81
82
        ];

        return (
Tamas Kecskes's avatar
Tamas Kecskes committed
83
            <div>
Patrik Meijer's avatar
Patrik Meijer committed
84
85
86
87
88
89
90
91
92
93
94
95
96
                {DEMOS.map(info => (
                    <ExpansionPanel defaultExpanded key={info.title}>
                        <ExpansionPanelSummary>
                            <Typography variant="headline" color="textSecondary">{info.title}</Typography>
                        </ExpansionPanelSummary>
                        <div style={{
                            padding: 20,
                            height: info.height,
                        }}
                        >
                            {info.component}
                        </div>
                    </ExpansionPanel>))}
Tamas Kecskes's avatar
Tamas Kecskes committed
97
            </div>);
Patrik Meijer's avatar
Patrik Meijer committed
98
99
    }
}
100
101


Patrik Meijer's avatar
Patrik Meijer committed
102
export default DragDropContext(HTML5Backend)(demoApp);