feat(ui): simplify Header usage
This commit is contained in:
parent
ba38e80bdb
commit
69604a36b4
|
@ -2,12 +2,14 @@ import React from 'react';
|
||||||
import { BrowserRouter as Router, Link, Route, Routes } from 'react-router-dom';
|
import { BrowserRouter as Router, Link, Route, Routes } from 'react-router-dom';
|
||||||
|
|
||||||
import Entity from './pages/entity';
|
import Entity from './pages/entity';
|
||||||
|
import Header from './components/header';
|
||||||
import Home from './pages/home';
|
import Home from './pages/home';
|
||||||
|
|
||||||
export default function App(){
|
export default function App(){
|
||||||
return (
|
return (
|
||||||
<div className='App'>
|
<div className='App'>
|
||||||
<Router>
|
<Router>
|
||||||
|
<Header />
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path='/' element={<Home/>}/>
|
<Route path='/' element={<Home/>}/>
|
||||||
<Route path='/bike-ride' element={<Entity apiRoute='bike-ride/info' title='B+R Stations'/>}/>
|
<Route path='/bike-ride' element={<Entity apiRoute='bike-ride/info' title='B+R Stations'/>}/>
|
||||||
|
|
|
@ -1,19 +1,11 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Link} from 'react-router-dom';
|
|
||||||
|
|
||||||
import Fetch from '../components/fetch';
|
import Fetch from '../components/fetch';
|
||||||
|
|
||||||
export default function Entity({apiRoute, title}) {
|
export default function Entity({apiRoute, title}) {
|
||||||
return(
|
return(
|
||||||
<>
|
<>
|
||||||
<Link
|
|
||||||
to='/'
|
|
||||||
>
|
|
||||||
<button>
|
|
||||||
Home
|
|
||||||
</button>
|
|
||||||
</Link>
|
|
||||||
<Fetch
|
<Fetch
|
||||||
route={apiRoute}
|
route={apiRoute}
|
||||||
title={title}
|
title={title}
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { Link} from 'react-router-dom';
|
||||||
|
|
||||||
import '../style.css';
|
import '../style.css';
|
||||||
import {getBusStopCount, getBikeRideCount, getParkRideCount, getTrainStationCount, getTaxiCount, getTicketMachineCount, getTicketOfficeCount} from '../utils/api';
|
import {getBusStopCount, getBikeRideCount, getParkRideCount, getTrainStationCount, getTaxiCount, getTicketMachineCount, getTicketOfficeCount} from '../utils/api';
|
||||||
import Header from '../components/header';
|
|
||||||
|
|
||||||
export default function Home(){
|
export default function Home(){
|
||||||
|
|
||||||
|
@ -98,7 +97,6 @@ export default function Home(){
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Header />
|
|
||||||
<h1>RVB Display</h1>
|
<h1>RVB Display</h1>
|
||||||
<h2>Wellcome to the RVB Display!</h2>
|
<h2>Wellcome to the RVB Display!</h2>
|
||||||
<h3>Number of bike and ride (B&R) stations in the RVB area: {bikeRideCount}</h3>
|
<h3>Number of bike and ride (B&R) stations in the RVB area: {bikeRideCount}</h3>
|
||||||
|
|
Loading…
Reference in New Issue