demoApp.jsx 3.07 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 DemoSingleConnectedNode from '../src/components/SingleConnectedNode/demo';
Patrik Meijer's avatar
Patrik Meijer committed
18
import DemoInfoCard from '../src/components/InfoCard/demo';
Patrik Meijer's avatar
Patrik Meijer committed
19
import DemoPartBrowser from '../src/components/PartBrowser/demo';
20
21
22


class demoApp extends Component {
Patrik Meijer's avatar
Patrik Meijer committed
23
24
25
26
27
28
29
30
31
32
    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
33
                title: 'AttributeEditor',
Patrik Meijer's avatar
Patrik Meijer committed
34
35
36
            },
            {
                component: <DemoProjectSeedCards/>,
Patrik Meijer's avatar
Patrik Meijer committed
37
38
39
40
41
                title: 'ProjectSeedCards',
            },
            {
                component: <DemoConfirmDialog/>,
                title: 'ConfirmDialog',
Patrik Meijer's avatar
Patrik Meijer committed
42
            },
43
44
45
46
            {
                component: <DemoUserProfileNavigator/>,
                title: 'UserProfileNavigator',
            },
Tamas Kecskes's avatar
Tamas Kecskes committed
47
48
49
50
            {
                component: <DemoModalSpinner/>,
                title: 'ModalSpinner',
            },
51
52
53
            {
                component: <DemoContainmentCanvas/>,
                title: 'ContainmentCanvas',
Patrik Meijer's avatar
Patrik Meijer committed
54
                height: 400,
55
            },
56
            {
57
58
                component: <DemoSingleConnectedNode/>,
                title: 'SingleConnectedNode',
59
            },
Tamas Kecskes's avatar
Tamas Kecskes committed
60
61
62
            {
                component: <DemoInfoCard/>,
                title: 'InfoCard',
Patrik Meijer's avatar
Patrik Meijer committed
63
                height: 200,
Tamas Kecskes's avatar
Tamas Kecskes committed
64
            },
Patrik Meijer's avatar
Patrik Meijer committed
65
66
67
68
            {
                component: <DemoPartBrowser/>,
                title: 'PartBrowser',
            },
Patrik Meijer's avatar
Patrik Meijer committed
69
70
71
        ];

        return (
Tamas Kecskes's avatar
Tamas Kecskes committed
72
            <div>
Patrik Meijer's avatar
Patrik Meijer committed
73
74
75
76
77
78
79
80
81
82
83
84
85
                {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
86
            </div>);
Patrik Meijer's avatar
Patrik Meijer committed
87
88
    }
}
89
90


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