From b94f73377b9285b5947594baeccdead4f6ab44b1 Mon Sep 17 00:00:00 2001 From: Markus Grigull Date: Wed, 30 May 2018 11:12:56 +0200 Subject: [PATCH] Add editable header component --- src/components/editable-header.js | 81 ++++++++++++++++++++++++++++++ src/containers/select-file.js | 4 +- src/containers/select-simulator.js | 2 +- src/containers/simulation-model.js | 5 +- 4 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 src/components/editable-header.js diff --git a/src/components/editable-header.js b/src/components/editable-header.js new file mode 100644 index 0000000..3995a25 --- /dev/null +++ b/src/components/editable-header.js @@ -0,0 +1,81 @@ +/** + * File: header.js + * Author: Markus Grigull + * Date: 25.05.2018 + * + * This file is part of VILLASweb. + * + * VILLASweb is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * VILLASweb is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with VILLASweb. If not, see . + ******************************************************************************/ + +import React from 'react'; +import PropTypes from 'prop-types'; +import { Glyphicon, FormControl } from 'react-bootstrap'; + +class EditableHeader extends React.Component { + constructor(props) { + super(props); + + this.state = { + editing: false, + title: props.title + }; + } + + componentWillReceiveProps(nextProps) { + this.setState({ title: nextProps.title }); + } + + startEditing = () => { + this.setState({ editing: true }); + } + + stopEditing = () => { + this.setState({ editing: false }); + } + + onChange = event => { + + } + + render() { + if (this.state.editing) { + const editStyle = { + maxWidth: '500px' + }; + + return
+
+ + + + +
; + } + + return
+

+ {this.state.title} +

+ + +
; + } +} + +EditableHeader.PropTypes = { + title: PropTypes.string +}; + +export default EditableHeader; diff --git a/src/containers/select-file.js b/src/containers/select-file.js index 1940736..aeca543 100644 --- a/src/containers/select-file.js +++ b/src/containers/select-file.js @@ -1,7 +1,7 @@ /** * File: selectFile.js * Author: Markus Grigull - * Date: 10.08.2018 + * Date: 10.05.2018 * * This file is part of VILLASweb. * @@ -39,7 +39,7 @@ class SelectFile extends React.Component { sessionToken: UserStore.getState().token, selectedFile: '', uploadFile: null, - uploadProgress: 100 + uploadProgress: 0 }; } diff --git a/src/containers/select-simulator.js b/src/containers/select-simulator.js index ad42000..bcf7719 100644 --- a/src/containers/select-simulator.js +++ b/src/containers/select-simulator.js @@ -1,7 +1,7 @@ /** * File: selectSimulator.js * Author: Markus Grigull - * Date: 10.08.2018 + * Date: 10.05.2018 * * This file is part of VILLASweb. * diff --git a/src/containers/simulation-model.js b/src/containers/simulation-model.js index a1929d2..1e1379a 100644 --- a/src/containers/simulation-model.js +++ b/src/containers/simulation-model.js @@ -1,7 +1,7 @@ /** * File: simulationModel.js * Author: Markus Grigull - * Date: 10.08.2018 + * Date: 10.05.2018 * * This file is part of VILLASweb. * @@ -30,6 +30,7 @@ import AppDispatcher from '../app-dispatcher'; import SelectSimulator from './select-simulator'; import SelectFile from './select-file'; import SignalMapping from '../components/signal-mapping'; +import EditableHeader from '../components/editable-header'; class SimulationModel extends React.Component { static getStores() { @@ -89,7 +90,7 @@ class SimulationModel extends React.Component { }; return
-

{this.state.simulationModel.name}

+