This repository has been archived by the owner on May 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
100 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react' | ||
import { connect } from 'react-redux' | ||
import Link from 'ion-router/Link' | ||
import ExampleToggle from '../toggles/ExampleToggle' | ||
import thing from './Example' | ||
|
||
const Example = connect(state => ({ | ||
example: state.examples.example | ||
}))(thing) | ||
|
||
export default function Examples() { | ||
return ( | ||
<div> | ||
<ul> | ||
<li><Link route="examples" example="basic">Basic</Link></li> | ||
</ul> | ||
<ExampleToggle component={Example} /> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,30 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import { createStore, applyMiddleware, combineReducers, compose } from 'redux' | ||
import { Provider, connect } from 'react-redux' | ||
import makeRouter, { makeRouterMiddleware } from 'ion-router' | ||
import routing from 'ion-router/reducer' | ||
import examples from './redux/example' | ||
|
||
import App from './App' | ||
import './index.css' | ||
|
||
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose // eslint-disable-line | ||
const reducer = combineReducers({ | ||
routing, | ||
examples | ||
}) | ||
|
||
|
||
// set up the router and create the store | ||
const routerMiddleware = makeRouterMiddleware() | ||
const store = createStore(reducer, undefined, | ||
composeEnhancers(applyMiddleware(routerMiddleware))) | ||
makeRouter(connect, store) | ||
|
||
ReactDOM.render( | ||
<App />, | ||
<Provider store={store}> | ||
<App /> | ||
</Provider>, | ||
document.getElementById('root') | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import * as types from './types' | ||
|
||
export function chooseExample(example) { | ||
return { | ||
type: types.CHOOSE_EXAMPLE, | ||
payload: example | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import * as types from './types' | ||
|
||
const defaultState = { | ||
example: false | ||
} | ||
|
||
export default function reducer(state = defaultState, action) { | ||
if (!action || !action.type) return state | ||
switch (action.type) { | ||
case types.CHOOSE_EXAMPLE: | ||
return { | ||
...state, | ||
example: action.payload | ||
} | ||
default: | ||
return state | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const CHOOSE_EXAMPLE = 'CHOOSE_EXAMPLE' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Toggle from 'ion-router/Toggle' | ||
|
||
export default Toggle(state => state.examples.example) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import RouteToggle from 'ion-router/RouteToggle' | ||
|
||
export default RouteToggle('examples') |