Merge branch 'main' into we-out-of-creativity-for-names

This commit is contained in:
William Eriksson 2020-12-10 10:45:54 +01:00 committed by GitHub
commit 308bd7b99f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 3 deletions

View File

@ -18,6 +18,7 @@ import departureuser4 from '../APIexamples/departureuser4.json'
import Button from './Button.js';
import disruptIcon from '../img/flash.svg';
import globalData from '../GlobalData.js';
class SelectUserButton extends Button {
selectUser = () => {
@ -41,9 +42,13 @@ class SelectUserButton extends Button {
console.log(globData.stop)
}
updatePage = () => {
globalData.currentPage.render();
}
render() {
return (
<Button onClick={[this.selectUser]} className="disruptBtn">
<Button onClick={[this.selectUser, this.updatePage]} className="disruptBtn">
<img src={disruptIcon} alt="" />
<span>{this.props.username}</span>
</Button>

View File

@ -2,9 +2,12 @@ import React, { Component } from 'react';
import Header from '../Header.js';
import MainArea from '../MainArea.js';
import globalData from '../../GlobalData.js';
class Tickets extends Component {
render() {
globalData.currentPage = this;
return (
<>
<Header title="Biljetter" />

View File

@ -9,8 +9,12 @@ import clockIcon from '../../img/clock.svg';
import calendarIcon from '../../img/calendar.svg';
import recurringIcon from '../../img/redo.svg';
import globalData from '../../GlobalData.js';
class TicketsBuy extends Component {
render() {
globalData.currentPage = this;
return (
<>
<Header title="Köp biljett" />

View File

@ -10,15 +10,21 @@ import globalData from '../../GlobalData.js';
class TrafficInfo extends Component {
state = {
stop: globalData.stop
};
render() {
globalData.currentPage = this;
return (
<>
<Header title="Trafikinfo" />
<TopMenu>
<StopTitle stop={globalData.stop} />
<StopTitle stop={this.state.stop} />
</TopMenu>
<MainArea>
<TrafficList departures={globalData.stop.departures} />
<TrafficList departures={this.state.stop.departures} />
</MainArea>
</>
);

View File

@ -7,8 +7,12 @@ import TripSelector from '../TripSelector.js';
import '../css/TripSelector.css';
import globalData from '../../GlobalData.js';
class Travel extends Component {
render() {
globalData.currentPage = this;
return (
<>
<Header title="Reseplanering" />