Skip to content

Commit f586169

Browse files
author
chenbin92
authored
Merge pull request #57 from ice-lab/release/1.0.0
Release: 1.0.0
2 parents 968e57b + 375d480 commit f586169

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1193
-2632
lines changed

README.md

Lines changed: 223 additions & 525 deletions
Large diffs are not rendered by default.

README.zh-CN.md

Lines changed: 225 additions & 529 deletions
Large diffs are not rendered by default.

examples/todos-ts/package.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

examples/todos-ts/public/index.html

Lines changed: 0 additions & 15 deletions
This file was deleted.

examples/todos-ts/src/index.tsx

Lines changed: 0 additions & 141 deletions
This file was deleted.

examples/todos-ts/src/stores/index.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

examples/todos-ts/src/stores/todos.ts

Lines changed: 0 additions & 55 deletions
This file was deleted.

examples/todos-ts/src/stores/user.ts

Lines changed: 0 additions & 35 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

examples/todos/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
"name": "todos",
33
"version": "1.0.0",
44
"private": true,
5-
"main": "src/index.js",
65
"dependencies": {
7-
"@ice/store": "^0.4.x",
8-
"@ice/store-logger": "^0.1.x",
6+
"@ice/store": "^1.0.0",
97
"react": "16.8.6",
108
"react-dom": "16.8.6"
119
},
1210
"devDependencies": {
11+
"css-modules-typescript-loader": "^2.0.4",
12+
"ice-plugin-fusion": "^0.1.4",
13+
"ice-plugin-moment-locales": "^0.1.0",
1314
"ice-scripts": "^2.0.0"
1415
},
1516
"scripts": {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React from 'react';
2+
import store from '../store';
3+
4+
const { useModelActions } = store;
5+
6+
export default function TodoAdd() {
7+
const { add } = useModelActions('todos');
8+
9+
console.debug('TodoAdd rending...');
10+
return (
11+
<input
12+
onKeyDown={(event) => {
13+
if (event.keyCode === 13) {
14+
add({
15+
name: event.currentTarget.value,
16+
});
17+
event.currentTarget.value = '';
18+
}
19+
}}
20+
placeholder="Press Enter"
21+
/>
22+
);
23+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import React from 'react';
2+
import store from '../store';
3+
4+
const { useModel, useModelActionsState } = store;
5+
6+
export function TodoList({ title, subTitle, dataSource }, { toggle, remove }, actionsState) {
7+
return (
8+
<div>
9+
<h2>{title}</h2>
10+
<p>
11+
Now is using {subTitle}.
12+
</p>
13+
<ul>
14+
{dataSource.map(({ name, done = false }, index) => (
15+
<li key={index}>
16+
<label>
17+
<input
18+
type="checkbox"
19+
checked={done}
20+
onChange={() => toggle(index)}
21+
/>
22+
{done ? <s>{name}</s> : <span>{name}</span>}
23+
</label>
24+
{
25+
actionsState.remove.isLoading ?
26+
'...deleting...' :
27+
<button type="submit" onClick={() => remove(index)}>-</button>
28+
}
29+
</li>
30+
))}
31+
</ul>
32+
</div>
33+
);
34+
}
35+
36+
export default function({ title }) {
37+
const [ state, actions ] = useModel('todos');
38+
const actionsState = useModelActionsState('todos');
39+
return TodoList(
40+
{ ...state, title, subTitle: 'Function Component' },
41+
actions,
42+
actionsState,
43+
);
44+
}

0 commit comments

Comments
 (0)