grid: need to find a way to add angular component inside react

This commit is contained in:
Torkel Ödegaard 2017-10-09 17:52:25 +02:00
parent 6cd2624caf
commit 63bf2a0278
3 changed files with 29 additions and 8 deletions

View File

@ -2,6 +2,7 @@ import React from 'react';
import coreModule from 'app/core/core_module';
import ReactGridLayout from 'react-grid-layout';
import {DashboardModel} from '../model';
import {DashboardPanel} from './DashboardPanel';
import sizeMe from 'react-sizeme';
const COLUMN_COUNT = 24;
@ -68,14 +69,7 @@ export class DashboardGrid extends React.Component<DashboardGridProps, any> {
for (let panel of this.props.dashboard.panels) {
panelElements.push(
<div key={panel.id.toString()} className="panel">
<div className="panel-container">
<div className="panel-header grid-drag-handle">
<div className="panel-title-container">{panel.type}</div>
</div>
<div className="panel-content">
{panel.title} - {panel.type}
</div>
</div>
<DashboardPanel panel={panel} />
</div>,
);
}

View File

@ -0,0 +1,24 @@
import React from 'react';
export interface DashboardPanelProps {
panel: any;
}
export class DashboardPanel extends React.Component<DashboardPanelProps, any> {
private element: any;
constructor(props) {
super(props);
this.state = {};
}
componentDidMount() {
}
render() {
return (
<div ref={element => this.element = element} />
);
}
}

View File

@ -0,0 +1,3 @@
import coreModule from 'app/core/core';