diff --git a/src/components/Button.js b/src/components/Button.js
index d6c6a90..1c7827a 100644
--- a/src/components/Button.js
+++ b/src/components/Button.js
@@ -1,14 +1,31 @@
-import React, {Component} from 'react';
+import React, { Component } from 'react';
class Button extends Component {
- render() {
+ // Multiple onClick functions
+ onClick = () => {
+ console.log(this.props.onClick);
+ if (this.props.onClick !== null
+ && this.props.onClick !== undefined) {
+ if (Array.isArray(this.props.onClick)) {
+ this.props.onClick.forEach(func => {
+ func();
+ });
+ } else {
+ console.log("Error when parsing Button onClick functions.");
+ }
+ } else {
+ console.log("Error when parsing Button onClick functions.");
+ }
+ }
+
+ render() {
return (
-
- {this.props.title}
-
+
);
}
}
-// TODO Add css
-export default Button
+
+export default Button;
\ No newline at end of file
diff --git a/src/components/DisruptionButton.js b/src/components/DisruptionButton.js
index e29fc2f..c88e5ca 100644
--- a/src/components/DisruptionButton.js
+++ b/src/components/DisruptionButton.js
@@ -1,24 +1,29 @@
import addNotification from "react-push-notification";
+import Button from './Button.js';
import disruptIcon from '../img/flash.svg';
-const DisruptionButton = () => {
- const genDisrupt = () => {
- addNotification({
- title: "Warning",
- subtitle: "This is a subtitle",
- message: "This is a very long message",
- theme: "blue",
- native: true, // when using native, your OS will handle theming.
- });
- };
- return (
-
- );
-};
+class DisruptionButton extends Button {
+ genDisrupt = () => {
+ addNotification({
+ title: "Warning",
+ subtitle: "This is a subtitle",
+ message: "This is a very long message",
+ theme: "blue",
+ native: true, // when using native, your OS will handle theming.
+ });
+ }
+
+ render() {
+ return (
+
+ );
+ }
+}
+
export default DisruptionButton;
diff --git a/src/components/MenuButton.js b/src/components/MenuButton.js
index 0c78162..0ab96d0 100644
--- a/src/components/MenuButton.js
+++ b/src/components/MenuButton.js
@@ -1,20 +1,21 @@
-import React, { Component } from 'react';
+import Button from './Button.js';
-class MenuButton extends Component {
+
+class MenuButton extends Button {
render() {
if (this.props.childOrderReverse) {
return (
-
);
} else {
return (
- Välj hållplats:
+
+
+