diff --git a/src/GlobalData.js b/src/GlobalData.js
new file mode 100644
index 0000000..3f4e9b9
--- /dev/null
+++ b/src/GlobalData.js
@@ -0,0 +1,12 @@
+import User from './classes/User.js';
+import Coordinates from "./classes/Coordinates.js";
+
+let globalData = {
+ user: new User(
+ "test",
+ "123",
+ new Coordinates()
+ )
+};
+
+export default globalData;
\ No newline at end of file
diff --git a/src/classes/User.js b/src/classes/User.js
index deb3ce2..bd48e47 100644
--- a/src/classes/User.js
+++ b/src/classes/User.js
@@ -1,12 +1,14 @@
/*
Denna klass är en modell för användare.
- deviceId : String (Enhetens ID)
+ name : String (Användarnamn)
+ deviceId : Int (Enhetens ID)
location : Coordinates (Användarens koordinater)
*/
class User {
- constructor(deviceId, location) {
+ constructor(name, deviceId, location) {
+ this.name = name;
this.deviceId = deviceId;
this.location = location;
this.stoppointgid = stoppointgid;
diff --git a/src/components/Button.js b/src/components/Button.js
index d6c6a90..873dc00 100644
--- a/src/components/Button.js
+++ b/src/components/Button.js
@@ -1,14 +1,30 @@
-import React, {Component} from 'react';
+import React, { Component } from 'react';
+
+import './css/Button.css';
+
class Button extends Component {
- render() {
+ // Multiple onClick functions
+ 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.");
+ }
+ }
+ }
+ 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:
+
+
+