Commit f688496d authored by CodeDuSoir's avatar CodeDuSoir
Browse files

toobib-92, toobib-91, toobib-82

parent 2c3b5da1
......@@ -4,6 +4,8 @@ import { BrowserRouter as Router, Route, Switch, Redirect } from 'react-router-d
import Body from './components/body';
import ToobibPage from './components/toobibPage';
import error from './components/error';
import SuspenseToobibPage from './components/toobibPageSuspense';
const urlAPI = 'https://annuaire.interhop.org/providers?search='
......@@ -48,7 +50,7 @@ export default class App extends Component {
<Router>
<Switch>
<Route exact path="/" render={(props) => <Body {...props} searchResult={searchResult} page={page} handleIndentation={this.handleIndentation} lastSearchTitle={lastSearchTitle} searchResult={searchResult} fetchData={this.fetchData} handleChange={this.handleChange} searchValue={searchValue} searchFunction={this.searchFunction} /> } />
<Route path="/toobibPage" component={ToobibPage} />
<Route path="/toobibPage/:Id" component={ToobibPage} />
<Route exact path="/404" component={error} />
<Redirect to="/404" />
</Switch>
......
......@@ -37,7 +37,7 @@ export default class ResultCards extends Component {
{e.libelleProfession}
<br />
</div>
<Link to="/toobibPage" className="button is-link is-light has-text-right">Consulter</Link>
<Link to={"/toobibPage/" + e.id} className="button is-link is-light has-text-right" value={e.id}>Consulter</Link>
</div>
</div>
</div>
......
import React, { Component } from 'react';
import Header from './header';
const ToobibPage = () => {
const urlAPI = 'https://annuaire.interhop.org/provider/'
return (
export default class ToobibPage extends Component {
state = {
data: null,
id: this.props.match.params.Id
};
componentDidMount() {
fetch(urlAPI + this.state.id, { header: {'Access-Control-Allow-Origin': '*'}})
.then(data => data.json())
.then(data => this.setState({ data }));
}
render() {
if(this.data) {
return (
<div>
<Header />
<div className="container column is-10">
......@@ -12,21 +26,21 @@ const ToobibPage = () => {
<div className="IMG_container">
<img className="IMG_container__img--doctor"/>
</div>
<h3 className="toobib_data__title">Dr Emma Helfen</h3>
<h4 className="toobib_data__position">Rhumatologue</h4>
<p className="toobib_data__number">+33 12 34 56 78 99</p>
<p className="toobib_data__email">email@email.com</p>
<p className="toobib_data__convention">Conventionnement: normal</p>
<h3 className="toobib_this.data__title">{this.data.prenom} {this.data.nom}</h3>
<h4 className="toobib_this.data__position">{this.data.libelleProfession}</h4>
<p className="toobib_this.data__number">{this.data.telephone}</p>
<p className="toobib_this.data__email">{this.data.email}</p>
<p className="toobib_this.data__convention">Conventionnement: {this.data.conventionnement}</p>
</div>
<br/>
<div className="card location_data">
<h3 className="location_data__title">Adresse</h3>
<p className="location_data__address">Centre de consultations Courlancy</p>
<p className="location_data__address">38 Bis Rue de Courlancy, 51100 Reims</p>
<p className="location_data__address">XX rue TEST TEST, {this.data.libelleCommune}</p>
<h3 className="location_data__title">Informations supplémentaires</h3>
<h4 className="location_data__info">2ème étage avec ascenseur</h4>
<p className="location_data__info">Accès handicapé</p>
<p className="location_data__info">Parking payant</p>
<p className="location_data__info">TEST TEST INFO SUP</p>
<p className="location_data__info">TEST INFO HANDICAPE</p>
<p className="location_data__info">TEST INFO Parking </p>
<div className="MAP_container">
<img className="MAP_container__map--doctor"/>
</div>
......@@ -34,8 +48,12 @@ const ToobibPage = () => {
</div>
</div>
);
} else {
return(
<h1> Loading </h1>
);
}
}
};
export default ToobibPage;
import React, { Suspense } from "react";
import ToobibPage from "./toobibPage";
const SuspenseToobibPage = (props) => {
return(
<Suspense fallback={<div>Fetching employees...</div>}>
<ToobibPage resource={props}/>
</Suspense>
)
};
export default SuspenseToobibPage;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment