Skip to content

Commit d2132b4

Browse files
Merge pull request cerebral#124 from cerebral/docUpdates
docs(website): update docs to match current api
2 parents e6fe433 + 6d7be13 commit d2132b4

File tree

20 files changed

+146
-90
lines changed

20 files changed

+146
-90
lines changed

packages/overmind-website/examples/guide/connectingcomponents/array_1.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const typescript = {
4040
fileName: 'components/List.tsx',
4141
code: `
4242
import * as React from 'react'
43-
import { Connect } from './app'
43+
import { connect, Connect } from './app'
4444
4545
const List: React.SFC<Connect> = ({ app }) => (
4646
<h1>{app.state.items}</h1>

packages/overmind-website/examples/guide/connectingcomponents/array_2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const typescript = {
4848
fileName: 'components/List.tsx',
4949
code: `
5050
import * as React from 'react'
51-
import { Connect } from './app'
51+
import { connect, Connect } from './app'
5252
5353
const List: React.SFC<Connect> = ({ app }) => (
5454
<ul>

packages/overmind-website/examples/guide/connectingcomponents/array_3.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const typescript = {
8383
fileName: 'components/Item.jsx',
8484
code: `
8585
import React from 'react'
86-
import { Connect } from './app'
86+
import { connect, Connect } from './app'
8787
8888
type Props = {
8989
item: { title: string }
@@ -100,7 +100,7 @@ export default connect(Item)
100100
fileName: 'components/List.tsx',
101101
code: `
102102
import * as React from 'react'
103-
import { Connect } from './app'
103+
import { connect, Connect } from './app'
104104
import Item from './Item'
105105
106106
const List: React.SFC<Connect> = ({ app }) => (

packages/overmind-website/examples/guide/connectingcomponents/connect.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const typescript = {
4747
fileName: 'components/App.tsx',
4848
code: `
4949
import * as React from 'react'
50-
import { Connect } from './app'
50+
import { connect, Connect } from '../app'
5151
5252
const App: React.SFC<Connect> = ({ app }) => {
5353
if (app.state.isLoading) {
@@ -64,7 +64,7 @@ export default connect(App)
6464
vue: javascript.vue,
6565
angular: [
6666
{
67-
fileName: 'app.component.js',
67+
fileName: 'app.component.ts',
6868
code: `
6969
import { Component } from '@angular/core';
7070
import { connect } from '../app'

packages/overmind-website/examples/guide/connectingcomponents/object_1.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const typescript = {
4040
fileName: 'components/List.tsx',
4141
code: `
4242
import * as React from 'react'
43-
import { Connect } from './app'
43+
import { connect, Connect } from './app'
4444
4545
const List: React.SFC<Connect> = ({ app }) => (
4646
<h1>{app.state.items}</h1>

packages/overmind-website/examples/guide/connectingcomponents/object_2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const typescript = {
8383
fileName: 'components/Item.jsx',
8484
code: `
8585
import React from 'react'
86-
import { Connect } from './app'
86+
import { connect, Connect } from './app'
8787
8888
type Props = {
8989
item: { title: string }
@@ -100,7 +100,7 @@ export default connect(Item)
100100
fileName: 'components/List.tsx',
101101
code: `
102102
import * as React from 'react'
103-
import { Connect } from './app'
103+
import { connect, Connect } from './app'
104104
import Item from './Item'
105105
106106
const List: React.SFC<Connect> = ({ app }) => (

packages/overmind-website/examples/guide/creatingactions/composing.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const initializeApp: Action = action =>
1717
action
1818
.when(operations.hasValidToken, {
1919
true: loadApplication,
20-
false: action => getValidToken(action).compose(loadApplication)
20+
false: getValidToken
2121
})
2222
`,
2323
},
@@ -38,7 +38,7 @@ export const initializeApp = action =>
3838
action
3939
.when(operations.hasValidToken, {
4040
true: loadApplication,
41-
false: action => getValidToken(action).compose(loadApplication)
41+
false: getValidToken
4242
})
4343
`,
4444
},

packages/overmind-website/examples/guide/creatingactions/instead.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default (ts) =>
44
{
55
fileName: 'app/actions.ts',
66
code: `
7-
import { Action } from 'overmind'
7+
import { Action, action } from 'overmind'
88
99
export const initializeApp: Action = action
1010
`,
@@ -14,6 +14,8 @@ export const initializeApp: Action = action
1414
{
1515
fileName: 'app/actions.js',
1616
code: `
17+
import { action } from 'overmind'
18+
1719
export const initializeApp = action
1820
`,
1921
},

packages/overmind-website/examples/guide/getstarted/operations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default (ts) =>
77
import { Operation } from 'overmind'
88
99
export const getPosts: Operation.Map<any, Promise<Post[]>> =
10-
({ effects }) => effects.jsonPlaceholder.getPosts()
10+
({ jsonPlaceholder }) => jsonPlaceholder.getPosts()
1111
`,
1212
},
1313
]
@@ -16,7 +16,7 @@ export const getPosts: Operation.Map<any, Promise<Post[]>> =
1616
fileName: 'app/operations.js',
1717
code: `
1818
export const getPosts =
19-
({ effects }) => effects.jsonPlaceholder.getPosts()
19+
({ jsonPlaceholder }) => jsonPlaceholder.getPosts()
2020
`,
2121
},
2222
]
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
export default (ts) =>
2+
ts
3+
? [
4+
{
5+
fileName: 'app/effects.ts',
6+
code: `
7+
import page from 'page'
8+
9+
export const router = {
10+
route<T extends object>(route: string, action: (params: T) => void) {
11+
page(route, ({ params }) => action(params))
12+
},
13+
start: () => page.start(),
14+
open: (url: string) => page.show(url)
15+
}
16+
`,
17+
},
18+
]
19+
: [
20+
{
21+
fileName: 'app/effects.js',
22+
code: `
23+
import page from 'page'
24+
25+
export const router = {
26+
route(route, action) {
27+
page(route, ({ params }) => action(params))
28+
},
29+
start: () => page.start(),
30+
open: (url) => page.show(url)
31+
}
32+
`,
33+
},
34+
]

0 commit comments

Comments
 (0)