App tile and app dialog styling
This commit is contained in:
parent
0e5657333f
commit
e8837d28ef
4 changed files with 188 additions and 10 deletions
|
@ -18,6 +18,8 @@ limitations under the License.
|
|||
|
||||
const React = require('react');
|
||||
const AddAppDialog = require('../dialogs/AddAppDialog');
|
||||
const AppTile = require('../elements/AppTile');
|
||||
const Modal = require("../../../Modal");
|
||||
|
||||
module.exports = React.createClass({
|
||||
displayName: 'AppsDrawer',
|
||||
|
@ -26,26 +28,51 @@ module.exports = React.createClass({
|
|||
},
|
||||
|
||||
componentDidMount: function() {
|
||||
const as = this.state.apps;
|
||||
as.push({
|
||||
id: "bbcApp",
|
||||
url: "http://news.bbc.co.uk",
|
||||
name: "BBC News",
|
||||
});
|
||||
this.setState({apps: as});
|
||||
},
|
||||
|
||||
getInitialState: function() {
|
||||
// this.onClickAddWidget = this.onClickAddWidget.bind(this);
|
||||
return {
|
||||
addAppWidget: false,
|
||||
apps: [{
|
||||
id: "googleApp",
|
||||
url: "http://matrix.org/grafana/dashboard/db/golang-metrics?panelId=2&fullscreen&edit&var-bucket_size=1m&var-job=riot-bot&var-handler=All&from=1495188444653&to=1495210044654",
|
||||
name: "Google",
|
||||
}],
|
||||
};
|
||||
},
|
||||
|
||||
onClickAddWidget: function() {
|
||||
this.setState({
|
||||
addAppWidget: true,
|
||||
Modal.createDialog(AddAppDialog, {
|
||||
onFinished: (proceed, reason) => {
|
||||
if (!proceed) return;
|
||||
|
||||
this.state.apps.push();
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
render: function() {
|
||||
const apps = this.state.apps.map(
|
||||
(app) => <AppTile key={app.id} url={app.url} name={app.name}/>);
|
||||
|
||||
return (
|
||||
<div className="mx_AppsDrawer">
|
||||
<div onClick={this.onClickAddWidget} role="button" tabIndex="0" className="mx_AddWidget_button" title="Add a widget">[+] Add a widget</div>
|
||||
{this.state.addAppWidget && AddAppDialog}
|
||||
<div id="apps" className="mx_AppsContainer">
|
||||
{apps}
|
||||
</div>
|
||||
<div onClick={this.onClickAddWidget}
|
||||
role="button"
|
||||
tabIndex="0"
|
||||
className="mx_AddWidget_button"
|
||||
title="Add a widget">
|
||||
[+] Add a widget
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue