Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
feat(init): add basic routing
Browse files Browse the repository at this point in the history
  • Loading branch information
jackcmeyer committed Nov 20, 2019
1 parent c6d712b commit c220b96
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 39 deletions.
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
"@semantic-release/git": "~7.0.16",
"@semantic-release/release-notes-generator": "~7.3.0",
"pouchdb": "~7.1.1",
"bootstrap": "^4.3.1",
"react": "~16.10.2",
"react-dom": "~16.10.2",
"react-router": "~5.1.2",
"react-router-dom": "~5.1.2",
"react-scripts": "~3.2.0",
"typescript": "~3.7.2"
},
Expand All @@ -35,16 +38,14 @@
"@semantic-release/github": "^5.4.3",
"@semantic-release/release-notes-generator": "~7.3.0",
"@types/jest": "~24.0.18",
<<<<<<< HEAD
"@types/node": "~12.12.9",
=======
"@types/node": "~12.7.8",
"@types/pouchdb": "~6.4.0",
>>>>>>> feat(init): creates a very simple pouchdb client
"@types/react": "~16.9.6",
"@types/react-dom": "~16.9.4",
"@typescript-eslint/eslint-plugin": "~2.8.0",
"@typescript-eslint/parser": "~2.8.0",
"@types/react-dom": "~16.9.1",
"@types/react-router": "~5.1.2",
"@types/react-router-dom": "~5.1.0",
"@typescript-eslint/eslint-plugin": "~2.4.0",
"@typescript-eslint/parser": "~2.4.0",
"commitizen": "^4.0.3",
"commitlint-config-cz": "^0.12.1",
"cross-env": "~6.0.3",
Expand Down
32 changes: 0 additions & 32 deletions src/App.css

This file was deleted.

11 changes: 11 additions & 0 deletions src/components/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React, { Component } from 'react';

class Dashboard extends Component {
render() {
return (
<h1>Hello Dashboard</h1>
);
}
}

export default Dashboard;
50 changes: 50 additions & 0 deletions src/components/HospitalRun.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React, { Component } from 'react';
import { Switch, Route, withRouter, RouteComponentProps } from 'react-router-dom';
import { Navbar } from '@hospitalrun/components';
import Dashboard from './Dashboard';
import Patient from './Patient';
import Patients from './Patients';
import NewPatient from './NewPatient';

class HospitalRun extends Component<RouteComponentProps, {}> {
constructor(props: RouteComponentProps) {
super(props);
this.noOpHandler = this.noOpHandler.bind(this);
}

noOpHandler() {
console.log('no op');
}

navigate(route: string) {
this.props.history.push(route);
}

render() {
return (
<div>
<Navbar
brand={{
label: 'HospitalRun',
onClick: () => {this.navigate('/')}
}}
bg="light"
variant="light"
onSeachButtonClick={this.noOpHandler}
onSearchTextBoxChange={this.noOpHandler}
navLinks={[{ label: 'Patients', onClick: () => {this.navigate('/patients')}, children: [] }]}
/>
<div>
<Switch>
<Route exact path="/" component={Dashboard} />
<Route exact path="/patients" component={Patients} />
<Route exact path="/new/patient" component={NewPatient} />
<Route exact path="/patients/:id" component={Patient} />
</Switch>
</div>
</div>
)
}
}

export default withRouter(HospitalRun);
11 changes: 11 additions & 0 deletions src/components/NewPatient.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React, { Component } from 'react';

class NewPatient extends Component {
render() {
return (
<h1>New Patient</h1>
);
}
}

export default NewPatient;
11 changes: 11 additions & 0 deletions src/components/Patient.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React, { Component } from 'react';

class Patient extends Component {
render() {
return (
<h1>Patient</h1>
);
}
}

export default Patient;
14 changes: 14 additions & 0 deletions src/components/Patients.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React, { Component } from 'react';

class Patients extends Component {
render() {
return (
<div>
<h1>Patients</h1>
</div>

);
}
}

export default Patients;
Binary file removed src/hospitalrun-icon-transparent.png
Binary file not shown.

0 comments on commit c220b96

Please sign in to comment.