diff --git a/src/components/ButtonModule.js b/src/components/ButtonModule.js
index 71188bc..bdebc95 100644
--- a/src/components/ButtonModule.js
+++ b/src/components/ButtonModule.js
@@ -57,10 +57,10 @@ export default class ButtonModule extends KtaneModule {
{
this.allColours.map(colour => (
))
}
@@ -73,8 +73,8 @@ export default class ButtonModule extends KtaneModule {
))
}
diff --git a/src/components/ButtonModuleColourInput.js b/src/components/ButtonModuleColourInput.js
index fc67eda..48229b4 100644
--- a/src/components/ButtonModuleColourInput.js
+++ b/src/components/ButtonModuleColourInput.js
@@ -1,31 +1,12 @@
-import PropTypes from 'prop-types';
-import React, {Component} from "react";
+import React from "react";
+import ButtonModuleTextInput from "./ButtonModuleTextInput";
-export default class ButtonModuleColourInput extends Component {
- render() {
+export default class ButtonModuleColourInput extends ButtonModuleTextInput {
+ getLabelContent() {
return (
-
+
+ {this.props.value.charAt(0).toUpperCase() + this.props.value.slice(1)}
+
)
}
-
- shouldComponentUpdate(nextProps) {
- return this.props.stateColour !== nextProps.stateColour;
- }
}
-
-ButtonModuleColourInput.propTypes = {
- colour: PropTypes.string,
- onChange: PropTypes.func,
- stateColour: PropTypes.string
-};
diff --git a/src/components/ButtonModuleTextInput.js b/src/components/ButtonModuleTextInput.js
index eafb7a7..ef799a8 100644
--- a/src/components/ButtonModuleTextInput.js
+++ b/src/components/ButtonModuleTextInput.js
@@ -2,27 +2,31 @@ import PropTypes from 'prop-types';
import React, {Component} from "react";
export default class ButtonModuleTextInput extends Component {
+ getLabelContent() {
+ return this.props.value;
+ }
+
render() {
return (
)
}
shouldComponentUpdate(nextProps) {
- return this.props.stateText !== nextProps.stateText;
+ return this.props.stateValue !== nextProps.stateValue;
}
}
ButtonModuleTextInput.propTypes = {
onChange: PropTypes.func,
- stateText: PropTypes.string,
- text: PropTypes.string
+ stateValue: PropTypes.string,
+ value: PropTypes.string
};