Skip to content

Commit

Permalink
add initial context
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaitaivli committed Jul 3, 2019
1 parent ac4c501 commit ca1b5c2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
4 changes: 4 additions & 0 deletions client/src/models/OddFractionalDecimal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const OddFractionalDecimal = {
'fractional': 'fractional',
'decimal': 'decimal'
}
24 changes: 14 additions & 10 deletions client/src/pages/landingPage/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@ import { Route, Redirect, BrowserRouter as Router, Switch } from 'react-router-d
import LiveFootballEvents from '../../components/LiveFootballEvents/LiveFootballEvents';
import { Container } from './App.css'
import EventCard from '../EventCard/EventCard';
import { AppStoreContext } from '../../stores/appStoreContext'
import { OddFractionalDecimal } from '../../models/OddFractionalDecimal';

export const App: React.FC = () => (
<Container>
<div>Header here</div>
<Router>
<Switch>
<Route exact path='/' render={() =>
<Redirect to='/events' />}
/>
<Route exact path='/events' component={LiveFootballEvents} />
<Route exact path='/events/:eventId' component={EventCard} />
</Switch>
</Router>
<AppStoreContext.Provider value={{oddType: OddFractionalDecimal.fractional}}>
<div>Header here</div>
<Router>
<Switch>
<Route exact path='/' render={() =>
<Redirect to='/events' />}
/>
<Route exact path='/events' component={LiveFootballEvents} />
<Route exact path='/events/:eventId' component={EventCard} />
</Switch>
</Router>
</AppStoreContext.Provider>
</Container>
);
6 changes: 6 additions & 0 deletions client/src/stores/appStoreContext.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react'
import { OddFractionalDecimal } from '../models/OddFractionalDecimal'



export const AppStoreContext = React.createContext({oddType: OddFractionalDecimal.fractional})
3 changes: 2 additions & 1 deletion client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve"
"jsx": "preserve",
"experimentalDecorators": true
},
"include": [
"src"
Expand Down

0 comments on commit ca1b5c2

Please sign in to comment.